SA-MP Forums Archive
[MySQL] Syntax error, what? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [MySQL] Syntax error, what? (/showthread.php?tid=200622)



[MySQL] Syntax error, what? - DVDK - 18.12.2010

Strange thing right here, this is what it says in the logs:

Quote:

[23:26:53] CMySQLHandler::Query(UPDATE rpg_houses SET Int='6',Vir='0',Class='1',Price='0',Locked='1',Bou ght='0',Owner='0',Used='0' WHERE ID='0') - An error has occured. (Error ID: 1064, 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 'Int='6',Vir='0',Class='1',Price='0',Locked='1',Bo ught='0',Owner='0',Used='0' WHE' at line 1)

I don't see what's wrong?


Re: [MySQL] Syntax error, what? - Marcel - 18.12.2010

You don't have to use ' if you're setting numbers. You can just do:
Code:
SET Int = 6, Vir = 0
etc.


Re: [MySQL] Syntax error, what? - Rachael - 18.12.2010

Here is a suggestion for correcting query syntax - remember that all or none of these things may help, and that some of these things may not be needed, but on the other hand, they may fix your error.

I assume your Bought field doesn't have the space in it ( Bo ught )
try putting the database and table name in the query, and use those funny half quote things.
try adding spaces after your field names, before the = sign.
try the query with and without the punctuation around the field values (despite marcels post above)
pawn Code:
UPDATE `database`.`table` SET `Int`= 6, `Vir` = 0 WHERE ...
Really you should be trying all these things yourself before posting on forums for help, but good luck anyway.


Re: [MySQL] Syntax error, what? - DVDK - 19.12.2010

Quote:
Originally Posted by Rachael
View Post
Here is a suggestion for correcting query syntax - remember that all or none of these things may help, and that some of these things may not be needed, but on the other hand, they may fix your error.

I assume your Bought field doesn't have the space in it ( Bo ught )
try putting the database and table name in the query, and use those funny half quote things.
try adding spaces after your field names, before the = sign.
try the query with and without the punctuation around the field values (despite marcels post above)
pawn Code:
UPDATE `database`.`table` SET `Int`= 6, `Vir` = 0 WHERE ...
Really you should be trying all these things yourself before posting on forums for help, but good luck anyway.
I've already tried all those, i use this way of scripting for about 2 years now no problem.
And somehow this forum created a space beween "bought", but in the logs and in the script it isn't there.


Re: [MySQL] Syntax error, what? - Bumbis - 19.12.2010

I think that string is too small. Try to make it bigger. It cutted out all that after WHE.


Re: [MySQL] Syntax error, what? - DVDK - 19.12.2010

Quote:
Originally Posted by silvis123
View Post
I think that string is too small. Try to make it bigger. It cutted out all that after WHE.
You can see, that in the first place it prints the query 100%, so the string is big enough, only the part where it prints the part of the problem is not fully.


Re: [MySQL] Syntax error, what? - Rachael - 19.12.2010

if you use phpmyadmin, just keep trying variations of the query until you don't get an error.
If you have been using the same query syntax for 2 years, I guess you should be looking at whatever has changed inbetween then and now.


Re: [MySQL] Syntax error, what? - armyoftwo - 19.12.2010

Post the query


Re: [MySQL] Syntax error, what? - DVDK - 19.12.2010

Quote:
Originally Posted by Rachael
View Post
if you use phpmyadmin, just keep trying variations of the query until you don't get an error.
If you have been using the same query syntax for 2 years, I guess you should be looking at whatever has changed inbetween then and now.
No i mean, i use the same methode for over 2 years, ofcourse the query's are different.


Re: [MySQL] Syntax error, what? - Marcel - 20.12.2010

Quote:
Originally Posted by Marcel
View Post
You don't have to use ' if you're setting numbers. You can just do:
Code:
SET Int = 6, Vir = 0
etc.
....