MySQL not making a new account
#1

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

You should use MySQL default values,instead of inserting 0s
Reply
#3

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?
Reply
#4

Just delete them,MySQL will set 0 by deffault anyway.No point of setting it manually
Reply
#5

How big is your query string?
Reply
#6

But can you find an error? I don't see anything wrong?

EDIT: Query string is 200
Reply
#7

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

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;
}
Reply
#9

Try increasing it slightly.
Reply
#10

That query, without the specifiers, is already 194 characters long.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)