MySql R33 Query Problem
#1

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

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

Код:
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...
Reply
#4

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')
Reply
#5

Код:
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)
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)