MySQL not making a new account -
FunnyBear - 10.03.2013
Hey guys,
It started again... I tested my script and MySQL would not make a new account. I get this error in the debug:
pawn Код:
- 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)
On this line:
pawn Код:
format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, Warnings, score, money, IP, Seconds, Minutes, Hours, register_date, Deaths, Kills) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, '%s', 0, 0, 0, NOW(), 0, 0)", pname, passwordstring, IP);
I don't see anything wrong in the script, I hope you can help me!
Thanks
Re: MySQL not making a new account -
dusk - 10.03.2013
You should use MySQL default values,instead of inserting 0s
Re: MySQL not making a new account -
FunnyBear - 10.03.2013
Quote:
Originally Posted by dusk
You should use MySQL default values,instead of inserting 0s
|
It worked fine before, just as I added Kills and Deaths it started?
Re: MySQL not making a new account -
dusk - 10.03.2013
Just delete them,MySQL will set 0 by deffault anyway.No point of setting it manually
Re: MySQL not making a new account -
Smally - 10.03.2013
How big is your query string?
Re: MySQL not making a new account -
FunnyBear - 10.03.2013
But can you find an error? I don't see anything wrong?
EDIT: Query string is 200
Re: MySQL not making a new account -
Smally - 10.03.2013
Quote:
Originally Posted by FunnyBear
But can you find an error? I don't see anything wrong?
EDIT: Query string is 200
|
So your define looks like this?
Re: MySQL not making a new account -
FunnyBear - 10.03.2013
Quote:
Originally Posted by Smally
So your define looks like this?
|
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
new query[200], pname[24], IP[16];
GetPlayerName(playerid, pname, 24);
GetPlayerIp(playerid, IP, 16);
format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, Warnings, score, money, IP, Seconds, Minutes, Hours, register_date, Deaths, Kills) VALUES('%s', SHA1('%s'), 0, 0, 0, 0, '%s', 0, 0, 0, NOW(), 0, 0)", pname, passwordstring, IP);
mysql_query(query);
SendClientMessage(playerid, INFO, ">> You have sucesfully registered a new account!");
Logged[playerid] = 1;
return 1;
}
Re: MySQL not making a new account -
Smally - 10.03.2013
Try increasing it slightly.
Re: MySQL not making a new account -
Vince - 10.03.2013
That query, without the specifiers, is already 194 characters long.