#1

Hi..
I have made a register command and I want to save player data in my mysql server, it is provided by triangle.gs
It doesn't save, anything.
Here's the command:
pawn Код:
CMD:register(playerid, params[])
{
    new pass[128];
    if(sscanf(params, "s[128]", pass)) return SendClientMessage(playerid, RED, "[ERROR] Correct Usage: /register [password]");
    {
    new query[1024];
    new name[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(query, sizeof(query), "INSERT INTO `users` (`id`, `Name`, `Password`, `Kills`, `Deaths`, `Score`, `Status`, `Health`, `Armour`, `Money`, `AdminLevel`, `VIPLevel`, `TotalTime`, `RegDate`, `Banned`, `Locked`) VALUES ('%d', '%s', '%s',0,0,0,0,0,0,0,0,0,0,0,0,0",UID, name, pass);
    mysql_query(query);
    print(query);
    SendClientMessage(playerid, WHITE, "You have successfully registered your account.");
    }
    return 1;
}
Please help me as soon as possible! My server needs to be public soon!
Reply
#2

pawn Код:
format(query, sizeof(query), "INSERT INTO `users` (`id`, `Name`, `Password`, `Kills`, `Deaths`, `Score`, `Status`, `Health`, `Armour`, `Money`, `AdminLevel`, `VIPLevel`, `TotalTime`, `RegDate`, `Banned`, `Locked`) VALUES ('%d', '%s', '%s',0,0,0,0,0,0,0,0,0,0,0,0,0)",UID, name, pass);
should work with this line.
In addition I would suggest to save "AdminLevel", "VIPLevel", "TotalTime", "RegDate", etc. in mysql with a standard value of 0. Then you don't need to do it in the query, and only need to set the id the name and the password.



(and using a hash for the password wouldn't be bad either)
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
pawn Код:
format(query, sizeof(query), "INSERT INTO `users` (`id`, `Name`, `Password`, `Kills`, `Deaths`, `Score`, `Status`, `Health`, `Armour`, `Money`, `AdminLevel`, `VIPLevel`, `TotalTime`, `RegDate`, `Banned`, `Locked`) VALUES ('%d', '%s', '%s',0,0,0,0,0,0,0,0,0,0,0,0,0)",UID, name, pass);
should work with this line.
In addition I would suggest to save "AdminLevel", "VIPLevel", "TotalTime", "RegDate", etc. in mysql with a standard value of 0. Then you don't need to do it in the query, and only need to set the id the name and the password.



(and using a hash for the password wouldn't be bad either)
What did you change exactly? D:

EDIT: Doesn't work.
Reply
#4

i added a ")" at the end of your query... check out the mysql error log, or at least the server log, there should occur an error.
Reply
#5

[15:53:21] ---------------------------

[15:53:21] MySQL Debugging activated (03/20/14)

[15:53:21] ---------------------------

[15:53:21]

[15:54:39] >> mysql_query( Connection handle: 1 )

[15:54:39] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[15:54:41] >> mysql_query( Connection handle: 1 )

[15:54:41] CMySQLHandler::Query() - You cannot call this function now. (Reason: Connection is dead)

[15:59:46] >> mysql_store_result( Connection handle: 1 )

[15:59:46] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[15:59:46] >> mysql_num_rows( Connection handle: 1 )

[15:59:46] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

[15:59:48] >> mysql_store_result( Connection handle: 1 )

[15:59:48] CMySQLHandler::StoreResult() - There is nothing to store (Reason: Connection is dead)

[15:59:48] >> mysql_num_rows( Connection handle: 1 )

[15:59:48] CMySQLHandler::NumRows() - You cannot call this function now. (Reason: Dead Connection)

I use the MySQL server provided by triangle.gs ..
Reply
#6

yea, you are not even connected to your mysql DB. then a query can't work ofc...
show us your mysql_connect
Reply
#7

pawn Код:
mysql_connect("37.59.28.180","lethal_1800","lethal_1800",""); // pass hidden :3
Reply
#8

Have you tried using "localhost" instead of "37.59.28.180" ?
Reply
#9

in case that you are connecting to a remote database, you should check whether it is allowing remoteaccess..
Reply
#10

I don't know shit about MySQL, and this database is provided by triangle.gs, the site I'm currently hosting my server at.
If someone can help me, add me in Skype, it is in my signature.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)