SA-MP Forums Archive
Mysql 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 Error (/showthread.php?tid=338352)



Mysql Error - Shockey HD - 29.04.2012

Код:
[13:06:26] CMySQLHandler::Query(INSERT INTO playerdata (user, password, score, money, IP, admin, skin, health, armor, xchord, ychord, zchord, virtualw, interior) VALUES('Fleming', SHA1('test'),0, 0, '127.0.0.1', 0, 0, 100, 0, 1) - 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)
Code:

Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[200], pname[24], IP[16];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 16);
    SetPlayerHealth(playerid,100);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, IP, admin, skin, health, armor, xchord, ychord, zchord, virtualw, interior) VALUES('%s', SHA1('%s'),0, 0, '%s', 0, 0, 100, 0, 1958, 1343, 15, 0, 0,0)", pname, passwordstring, IP);
    mysql_query(query);
    SendClientMessage(playerid, -1, "You have been registered on this server!");
    Logged[playerid] = 1; 
    return 1;
}



Re: Mysql Error - Crazymax - 29.04.2012

Try this...

pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[500], pname[24], IP[16];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 16);
    SetPlayerHealth(playerid,100);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, score, money, IP, admin, skin, health, armor, xchord, ychord, zchord, virtualw, interior) VALUES('%s', SHA1('%s'),0, 0, '%s', 0, 0, 100, 0, 1958, 1343, 15, 0, 0,0)", pname, passwordstring, IP);
    mysql_query(query);
    SendClientMessage(playerid, -1, "You have been registered on this server!");
    Logged[playerid] = 1;
    return 1;
}