Forum Moderators: coopster
line 21> $query = "UPDATE inventory SET type = $type [, order = $order]
[WHERE id = $id] LIMIT 1";
could not execute query.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 '[, order = 02] [WHERE id = 2] LIMIT 1' at line 21
Below works fine for a single column, so the connection gets made.
line 21> $query = "UPDATE vehicles SET type='$type'
WHERE id='$id' LIMIT 1";
Thank you in advance for any help offered.
I have tried that combination and a few others. Still get the error message with the changes reflected. This is how my book showed to do it and was my first try. The brackets were something I found on the web. I cut this short because it easier to change with less columns. There are really about 16 columns to update.
$query = "UPDATE vehicles SET type = '$type',order = '$order',stockID = '$stockID'
WHERE id = '$id' LIMIT 1";
could not execute query.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 'order = '02',stockID = '227' WHERE id = '2' LIMIT 1
According to my book this is supposed to be very straight forward?
Thanks though. I've been at this page for a while now. Getting a small bald spot from the hair ripping. : )
First, if I'm using mySQL, I get errors trying to run plain SQL code. Not sure what your setup is.
The most likely is this. You haven't used ` to enclose "order". Try:
$query = "UPDATE inventory SET type = '$type', `order` = '$order' WHERE id = '$id' LIMIT 1";
See, ORDER BY is a command in queries. Since you have a column named `order`, you must separate with ` so that the code knows it's not a command, and is, instead, a column name.