SA-MP Forums Archive
MySQL not making a new account - 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 not making a new account (/showthread.php?tid=421657)



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?

PHP код:
new query[200]; 



Re: MySQL not making a new account - FunnyBear - 10.03.2013

Quote:
Originally Posted by Smally
Посмотреть сообщение
So your define looks like this?

PHP код:
new query[200]; 
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.