MySQL update error - 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 update error (
/showthread.php?tid=247046)
MySQL update error -
Steve M. - 07.04.2011
Hey guys!
I don't know what is wrong with this:
Код:
mysql_query("UPDATE Characters SET Level = 5, Respect = 0, NRespect = 4, Skin = 15, Cash = 400, Bank = 55000, Job = 1, Leader = 1, Group = 1, Rank = 1, House = 1, RHouse = 1, Car = 1, MBike = 1, Bike = 1 WHERE Username = 'John' AND Chara = 0");
It gives this error:
Код:
CMySQLHandler::Query(UPDATE Characters SET Level = 5, Respect = 0, NRespect = 4, Skin = 15, Cash = 400, Bank = 55000, Job = 1, Leader = 1, Group = 1, Rank = 1, House = 1, RHouse = 1, Car = 1, MBike = 1, Bike = 1 WHERE Username = 'John' AND Chara = 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 'Group = 1, Rank = 1, House = 1, RHouse = 1, Car = 1, MBike = 1, Bike = 1 WHERE U' at line 1)
Re: MySQL update error -
[UG]Scripter - 07.04.2011
I dont know alot about SQL but shouldnt it be SELECT * ... FROM .... WHERE ... etc etc
Re: MySQL update error -
Steve M. - 07.04.2011
No, it shouldn't. Because I want to update the row that already exists.
Re: MySQL update error -
[UG]Scripter - 07.04.2011
As far as I can remember back to my SQL Days. 1064 is a Table Insertation error.... Meaning you have a problem inserting a table/row or instering into an actuall table that exists.
Re: MySQL update error -
Sergei - 07.04.2011
You didn't even read "CMySQLHandler::Query(.." till the end. Shame on you that you ask questions that log already answers you.
Re: MySQL update error -
Steve M. - 07.04.2011
Yes, I have.
Код:
CMySQLHandler::Query(UPDATE Characters SET Level = 5, Respect = 0, NRespect = 4, Skin = 15, Cash = 400, Bank = 55000, Job = 1, Leader = 1, Group = 1, Rank = 1, House = 1, RHouse = 1, Car = 1, MBike = 1, Bike = 1 WHERE Username = 'John' AND Chara = 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 'Group = 1, Rank = 1, House = 1, RHouse = 1, Car = 1, MBike = 1, Bike = 1 WHERE U' at line 1)
And I don't see the mistake. Can you tell me what's wrong?
Re: MySQL update error -
Sascha - 07.04.2011
pawn Код:
mysql_query("UPDATE `Characters` SET `Level` = 5, `Respect` = 0, `NRespect` = 4, `Skin` = 15, `Cash` = 400, `Bank` = 55000, `Job` = 1, `Leader` = 1, `Group` = 1, `Rank` = 1, `House` = 1, `RHouse` = 1, `Car` = 1, `MBike` = 1, `Bike` = 1 WHERE `Username` = 'John' AND `Chara` = 0");
try this
Re: MySQL update error -
Steve M. - 07.04.2011
Thanks, dude. It works.
Re: MySQL update error -
Sergei - 07.04.2011
Something wrong here?
Код:
Bike = 1 WHERE U' at line 1)
Re: MySQL update error -
Sascha - 07.04.2011
`Bike` and not Bike
the `s are necessary and important