View Full Version : Problem Updating Database Table

05-19-2011, 06:32 PM
The data is assigned via a form on a separate page being posted to a second page.

This is the update page but I keep a failed message -

I have done an exit to the query to see if the data is being assigned correctly and it is - so I am guessing that the issue is actually when it attempts to write the data into the database.

I have been working on this for a long time now trying to figure it out - any help to resolve this issue will be greatly appreciated.



$feild1_namep = $_POST['field1_name'];
$field2_descp = $_POST['field2_desc'];
$field3_categoryp = $_POST['field3_category'];
$field4_approvalp = $_POST['field4_approval'];

$query = "UPDATE products SET ";
$query .= "field1_name='$field1_namep',field2_desc='$field2_descp',field3_category='$field3_category',field4_ap provalp='field4_approval',";
$query .= "WHERE field1_name = '$field1_namep'";

$result = mysql_query ($query)
or die ("failed");

echo "<center>Product Updated.</center>";

05-19-2011, 09:03 PM
Echo mysql_error() when it fails.

And when you get that syntax error, it will point to the problem, which I just noticed is an errant comma.