#1

pawn Код:
case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);

            new query[256], password[50];
            mysql_real_escape_string(inputtext, password);
            format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `money`, `skin`) VALUES (`%s`, `%s`, `%d`, `%d`)", GetPName(playerid), password, 10000, 23);
            mysql_query(query);

            new str[128];
            format(str, sizeof(str), "(INFO){FFFFFF} You have successfully registered the name '%s.'", GetPName(playerid));

            SendClientMessage(playerid, COLOR_YELLOW, str);
            SendClientMessage(playerid, COLOR_YELLOW, "(INFO){FFFFFF} Enjoy your stay!");
        }
Why doesn't this update the table?
Reply
#2

pawn Код:
format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `money`, `skin`) VALUES ('%s', '%s', '%i', '%d')", GetPName(playerid), password, 10000, 23);
you can try that but don't use ` for values, use '
Reply
#3

Quote:
Originally Posted by itsCody
Посмотреть сообщение
pawn Код:
format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `money`, `skin`) VALUES ('%s', '%s', '%i', '%d')", GetPName(playerid), password, 10000, 23);
you can try that but don't use ` for values, use '
thank you
Reply
#4

To make this a tad more efficient, why don't you make the queries threaded? Or make the query shorter by using default values. I only save the password and username on registering. I've assigned default values in the tables.

pawn Код:
#define     THREAD_ADD_USER     1

//some callback.
format(query,sizeof(query),"...");
mysql_query(query,THREAD_ADD_USER,playerid);

//somewhere in your script.
public OnQueryFinish(query[], resultid, extraid, connectionHandle)
{
    switch(resultid)
    {
        case THREAD_ADD_USER:
        {
            //code
        }
    }
    return 1;
}
Or maybe upgrade to R38? Just a tip
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)