Table Not Updating
Posted: Mon Jul 03, 2006 2:13 pm
I am able to retrieve the data I need and create and populate the following, all these fields populate with the correct data
the form appears correctly and I am able to edit the fields I need to update.
My 'updatefawns.php' script is as follows
It seems to work - at least I don't get any error message, but when I look at the records in mysql query browser the record has not been updated. What do I have messed up in my UPDATE statement?
Code: Select all
$fawn_id=$ID;
echo "<form action='updatefawns.php' method=post>";
echo "<font color='#6F3700'><b> Record ID </b></font>";
echo "<input type=text name='$deerid' size='5' maxlength='6' READONLY value='$fawn_id'><br>";
echo "<font color='#6F3700'><b> Fawn ID </b></font>";
echo "<input type=text name='$fawnnumber' size='25' maxlength='25' READONLY value='$deernumber'><br>";
echo "<font color='#6F3700'><b> Sex </b></font>";
echo "<input type=text name='$fawns_sex' size='2' maxlength='1' value='$sex_of_fawn'><br>";
echo "<font color='#6F3700'><b>Date Of Birth </b></font>";
echo "<input type=text name='$fawns_date_of_birth' value='$dateofbirth'><br>";
echo "<font color='#6F3700'><b> Fawn Status </b></font>";
echo "<input type=text name='$fawns_status' size='2' maxlength='1' value='$statusofdeer'><br>";
echo "<input type=submit value=submit>";
echo "</form>";My 'updatefawns.php' script is as follows
Code: Select all
$fawnstatus = strip_tags(trim($_POST['fawns_status']));
$fawn_to_use=strip_tags(trim($_POST['fawnnumber']));
$fawn_id = $_POST['deerid'];
$host="localhost";
$user="username";
$password="password" ;
$connection = mysql_connect($host,$user,$password)
or die("Couldn't Make the Connection");
$database="thunde9_thunderhill";
$db = mysql_select_db($database,$connection)
or die("Couldn't Select Database");
$query="UPDATE fawns SET statusofdeer = '$fawnstatus'
WHERE ID = '$fawn_id' LIMIT 1" ;
$result = mysql_query($query)
or die ("Couldn't Execute Query.");