The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
UPDATE userbasket SET size = 'N', quantity = '1' WHERE index = '1'
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 'index = '1'' at line 1
Now the table name is definitely right, I've used it in a select query, and there's definitely a field named 'index' in the table... I'm aware there's no semi-colon at the end of the query, but I've tried adding one and the error is the same... I just can't see what's wrong with it. I thought maybe I didn't need the index number (1 in this case) in ''s, but again, removing them made no difference to the error. The index field in the database is an auto-increment integer, if that makes any difference.
Thanks for any help!
Well, I'll just try to avoid using "index" as a field name in future... Seems more trouble than it's worth!
Just noticed I put the wrong quotes. 'index' would just treat it as text (hence why your update didnt work), you need `index` to have it treated it as a field
I'm definitely using index numbers that exist as I'm getting them from this table in the first place... So it can't be the 'WHERE' clause I don't think.
I know it should return 0 if the details of the UPDATE query are the same as they were before the update, but the details are not the same, as I've echoed the query string and seen they are different from details currently in the database.
I just can't see anything wrong with the query strings, so have no idea why the queries wouldn't be working... They are as before, except the index is in single quotes as suggested...
[EDIT] - Think I may have fixed it. Changed the index field to ID, then changed all the mentions of index in the SQL queries and it all seems to work now!
Thanks, very helpful, as always!
UPDATE userbasket SET size = 'N', quantity = '1' WHERE index = '1'
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 'index = '1'' at line 1
Now the table name is definitely right, I've used it in a select query, and there's definitely a field named 'index' in the table... I'm aware there's no semi-colon at the end of the query, but I've tried adding one and the error is the same... I just can't see what's wrong with it. I thought maybe I didn't need the index number (1 in this case) in ''s, but again, removing them made no difference to the error. The index field in the database is an auto-increment integer, if that makes any difference.
Thanks for any help!