MySQL problem - 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)
+--- Thread: MySQL problem (
/showthread.php?tid=310314)
MySQL problem -
spedico - 11.01.2012
pawn Код:
format(Query, sizeof(Query), "INSERT INTO Players (Username, Password, Score, IP) VALUES('%s', SHA1('%s'), 0, '%s'", pName, password, IP);
Outcome:
Quote:
[19:08:49] CMySQLHandler::Query(INSERT INTO Players (Username, Password, Score, IP) VALUES('test', SHA1('password'), 0, 'my.ip.here') - 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 '' at line 1)
|
I also tried `Players` but same error.
Re: MySQL problem -
AndreT - 11.01.2012
You are missing a ) from the end I suppose.
Also, I suggest you use a default value for the Score field so you don't have to specify it in your INSERT query.
Re: MySQL problem -
spedico - 11.01.2012
Oh right. Was missing a ), thank you.
So if I set a default value for Score, I'll just leave it blank in the INSERT? Or do I have to add it to the INSERT at all?
Re: MySQL problem -
AndreT - 11.01.2012
If you have a default value for it, there's no need to include Score in your INSERT query at all. No field name, no value for it.
Re: MySQL problem -
spedico - 11.01.2012
Okay, thanks alot.