Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
04-26-2013, 02:22 PM #1
- Join Date
- Apr 2011
- Thanked 0 Times in 0 Posts
PHP mysql update row syntax error
Just trying to do a simple product edit page and for some reason it is giving the following error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc = 'This is the Pro Range Hoodie which is available in a variety of sizes in' at line 1
$updatewithnewimage = mysql_query("UPDATE `products3` SET `title` = $product_name, `club_id` = $product_club, `price` = $product_price, `product_range` = $product_range, `size_type` = $product_size, `imagename` = $product_image, `desc` = $product_desc WHERE `id` = $editid ") or die(mysql_error());
echo "product added with new image";
$updatewitholdimage = mysql_query("UPDATE products3 SET title = '$product_name', club_id = '$product_club', price = '$product_price', product_range = '$product_range', size_type = '$product_size', imagename = '$old_product_image', desc = '$product_desc' WHERE id = '$editid' ") or die(mysql_error());
echo "product added with old image";
Last edited by tim967; 04-26-2013 at 03:10 PM. Reason: resolved! big thanks!
04-26-2013, 02:36 PM #2
- Join Date
- Mar 2007
- Thanked 2,223 Times in 2,210 Posts
- Blog Entries
DESC is a mysql keyword. In your first query you have put back-ticks around it but there's no back-ticks in your second query.
PS: Using mysql keywords as the names of table/field is considered as a bad practice.
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
Users who have thanked abduraooft for this post: