||04-26-2013 03:22 PM
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
Here is the mysql part of the code, I know its probably something simple but i just cant seem to find it
$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";
||04-26-2013 03:36 PM
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. :)
|All times are GMT +1. The time now is 02:01 AM.
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.