SA-MP Forums Archive
MySql R33 Query Problem - 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 R33 Query Problem (/showthread.php?tid=501196)



MySql R33 Query Problem - radyx - 16.03.2014

Hello i have a problem with my mysql register...

I want to initialize the level field with 1 and the cash with 5000$ ... so that the player will start with that ammount!
Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[450], pname[24], IP[15];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 15);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, level, cash, admin, ban, faction ,IP) VALUES('%s', SHA1('%s'),1, 5000, 0, 0, 0, '%s')", pname,passwordstring,IP);
    new Cache:result = mysql_query(sql,query);
    cache_delete(result);
    Logged[playerid] = 1;
    return 1;
}
and the debug of this part:
Код:
[22:19:30] [DEBUG] mysql_query - connection: 1, query: "INSERT INTO playerdata (user, password, level, cash, admin, ban,", use_cache: true
[22:19:30] [DEBUG] CMySQLQuery::Execute - starting query execution
[22:19:30] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 33.228 milliseconds
[22:19:30] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[22:19:30] [DEBUG] CMySQLHandle::SaveActiveResult - cache saved (id: 2)
[22:19:30] [DEBUG] cache_delete - cache_id: 2, connection: 1
[22:19:30] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[22:19:30] [DEBUG] CMySQLHandle::DeleteSavedResult - result deleted
so if you can see the query is not fully loaded... I don't know.


a wierd thing is that the user and the password are inserted... + THE IP is inserted too...


Re: MySql R33 Query Problem - Calabresi - 16.03.2014

Probably the type of field is not what it's supposed to be. Are you sure you selected INT and not VARCHAR?


Re: MySql R33 Query Problem - radyx - 16.03.2014

Код:
mysql_query(sql,"CREATE TABLE IF NOT EXISTS playerdata(id INT(20) AUTO_INCREMENT , user VARCHAR(24), password VARCHAR(40), level INT(20), cash INT(20), admin INT(20), ban INT(20),faction INT(20),IP VARCHAR(15), PRIMARY KEY (id) )");
my table is created by this query...


Re: MySql R33 Query Problem - Calabresi - 16.03.2014

Try running this query through phpMyAdmin or a basic SQL console and see if it works.

pawn Код:
INSERT INTO playerdata (user, password, level, cash, admin, ban, faction ,IP) VALUES('Test_User', SHA1('Test'),1, 5000, 0, 0, 0, '127.0.0.1')



Re: MySql R33 Query Problem - radyx - 16.03.2014

Код:
1 row inserted.
Inserted row id: 5 (Query took 0.0904 sec)
It works perfect , the values are added fine in the db...

Where is the problem then?? ( Thank you very much for your help and time)


Re: MySql R33 Query Problem - Calabresi - 16.03.2014

Quote:
Originally Posted by radyx
Посмотреть сообщение
Код:
1 row inserted.
Inserted row id: 5 (Query took 0.0904 sec)
It works perfect , the values are added fine in the db...

Where is the problem then?? ( Thank you very much for your help and time)
Try updating the plugin to the latest version (R36 I think), and try again.


Re: MySql R33 Query Problem - radyx - 16.03.2014

SOLVED, there was something on ONPLAYERDISCONNECT(); that resets me those values, ITS DONE THANK YOU