Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Problem Updating Database Table
05-19-2011, 06:32 PM #1
- Join Date
- May 2011
- Thanked 0 Times in 0 Posts
Problem Updating Database Table
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.
<?php $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_approvalp='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 #2
- Join Date
- Dec 2005
- Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
- Thanked 637 Times in 625 Posts
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.