mysql query error
#1

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)
Reply
#2

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]);
Reply
#3

Still not working.

%e is escaping the string btw.
Reply
#4

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

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]); 
Reply
#6

@Kostantinos

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

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

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.
Reply
#9

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

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)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)