SA-MP Forums Archive
mysql query 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)
+--- Thread: mysql query error (/showthread.php?tid=522669)



mysql query error - sammp - 28.06.2014

Hey again. I've done another script since my last post, therefore, I'm posting a new topic.


Something is up with this query:

pawn Код:
mysql_format(szCurrent, query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0.0, 0.0, 0.0)", Name[playerid], Player[playerid][Password], IP[playerid]);
as the log states:
Код:
[19:01:44] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #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
EDIT: nvm, still persisting (same error)


Re : mysql query error - Chipardeur - 28.06.2014

pawn Код:
mysql_format(szCurrent, query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`) VALUES ('%s', '%s', '%s', 0, 0, 0, 0.0, 0.0, 0.0)", Name[playerid], Player[playerid][Password], IP[playerid]);



Re: mysql query error - sammp - 28.06.2014

Still not working.

%e is escaping the string btw.


Re: mysql query error - Konstantinos - 28.06.2014

Can you test it again and post the output (print the query)?


Re: mysql query error - Diverse - 28.06.2014

PHP код:
mysql_format(szCurrentquerysizeof(query), "INSERT INTO `accounts` (Username, Password, IP, Admin, VIP, Money, PosX, PosY, PosZ) VALUES ('%e', '%s', '%s', '0', '0', '0', '0.0', '0.0', '0.0')"Name[playerid], Player[playerid][Password], IP[playerid]); 



Re: mysql query error - sammp - 28.06.2014

@Kostantinos

Код:
[20:02:53] INSERT INTO `accounts` (Username, Password, IP, Admin, VIP, Money, PosX, PosY, PosZ) VALUES ('Kendrick_Lamar', '', '127.0.0.1',



Re: mysql query error - Faisal_khan - 28.06.2014

Are you sure your data type for Admin and the rest is set to int in your database?


Re: mysql query error - Konstantinos - 28.06.2014

That's the whole output? If yes, then the length of the string is not enough to hold the whole text - increase it. And by the way, password is NULL.


Re: mysql query error - sammp - 28.06.2014

Yeah I saw the password being null, that (i hope) is fixed!


Re: mysql query error - sammp - 28.06.2014

Thanks Kostantinos! Increasing the length worked perfectly for me! I cant give you rep as the forums arent letting me (already gave you some recently i guess)