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



MySQL - willsuckformoney - 28.04.2013

It creates the table (If it hasn't already been created) but when I try to register a name, it doesn't insert it into the table. Anyone know what's wrong?
pawn Код:
stock Register(playerid, pass[])
{
    new Query[200], name[24], ip[16];
    GetPlayerName(playerid,name,24);
    GetPlayerIp(playerid,ip,16);
    format(Query,200,"INSERT INTO `playerdata` (user, password, ip, money, score) VALUES ('%s', SHA('%s'), '%s', 0, 0)",name,pass,ip);
    mysql_query(Query);
    GameTextForPlayer(playerid,"~b~~h~registered",3000,3);
    Logged[playerid] = 1;
    return 1;
}



Re: MySQL - Scenario - 28.04.2013

Show your MySQL logs...


Re: MySQL - willsuckformoney - 28.04.2013

Код:
[17:25:04]  

[17:25:04] ---------------------------

[17:25:04] MySQL Debugging activated (04/28/13)

[17:25:04] ---------------------------

[17:25:04]  

[17:25:04] >> mysql_connect( )

[17:25:04] CMySQLHandler::Connect() - Connection was successful.

[17:25:04] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[17:25:04] >> mysql_query( Connection handle: 1 )

[17:25:04] CMySQLHandler::Query(CREATE TABLE IF NOT EXISTS playerdata(user VARCHAR(20), pass VARCHAR(20), ip VARCHAR(20), money INT(20), score INT(20))) - Successfully executed.

[17:25:17] >> mysql_query( Connection handle: 1 )

[17:25:17] CMySQLHandler::Query(SELECT `user` FROM `playerdata` WHERE `user` = 'willsuckformoney' LIMIT 1;) - Successfully executed.

[17:25:17] >> mysql_store_result( Connection handle: 1 )

[17:25:17] CMySQLHandler::StoreResult() - Result was stored.

[17:25:17] >> mysql_num_rows( Connection handle: 1 )

[17:25:17] CMySQLHandler::NumRows() - Returned 0 row(s)

[17:25:17] >> mysql_free_result( Connection handle: 1 )

[17:25:17] CMySQLHandler::FreeResult() - Result was successfully free'd.

[17:25:24] >> mysql_real_escape_string( Connection handle: 1 )

[17:25:24] CMySQLHandler::EscapeString(lalala); - Escaped 6 characters to lalala.

[17:25:24] >> mysql_query( Connection handle: 1 )

[17:25:24] CMySQLHandler::Query(INSERT INTO `playerdata` (user, password, ip, money, score) VALUES ('willsuckformoney', SHA('lalala'), '0.0.0.0', 0, 0)) - An error has occured. (Error ID: 1054, Unknown column 'password' in 'field list')

[17:25:28] >> mysql_query( Connection handle: 1 )

[17:25:28] CMySQLHandler::Query(UPDATE `playerdata` SET score=0, money=0 WHERE user='willsuckformoney') - Successfully executed.



Re: MySQL - Youice - 28.04.2013

well, try to increase the Query?
(I had this problem before and by increasing the Query array it worked), give it a try


Re: MySQL - willsuckformoney - 28.04.2013

I fixed it..