I have form that I want to use to update my a mySQl row. I have my search retrieval script done to find the record. Now I need to update it.
When I submit the form, I get a confirmation the part_no was updated, but it doesn't show up in the database.
What am I doing wrong? Does anyone see any errors in my script?
Thank you.
Erik
Here is my script:
<?PHP
session_start();
?>
<?php
$orig_time=$_POST['orig_time'];
$type=$_POST['type'];
$part_no=$_POST['part_no'];
$description=$_POST['description'];
$count=$_POST['count'];
$size=$_POST['size'];
$min=$_POST['min'];
$max=$_POST['max'];
$qty=$_POST['qty'];
if ($part_no == "") echo "! No identifier retrieved";
else
echo "Amending record $part_no";
$host="localhost";
$username="XXXXXX";
$password="XXXXXX";
$db_name="naturan8_hero";
$tbl_name="cartons_current";
mysql_connect("$host", "$username", "$password") or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
mysql_query("UPDATE cartons_current SET orig_time='$orig_time', type='$type',
description='$description', count='$count', size='$size', min='$min', max='$max',
qty='$qty', WHERE reference='$part_no'");
echo "<BR>$part_no was updated.<BR><BR>";
?>
,beforeWHERE. Are you sure that there is areferencewith the given$part_no?mysql_error()to check ifmysql_querygave any error.