MySQL Query
#1

Hello people, I came up with this error today when I was working on my MySQL script. When a player does /login normally they are able to get all their information and so on but when I add it one more line which is:
pawn Код:
playerinfo[playerid][uid] = strval(field[13]);
It shows up as the command doesn't work.
pawn Код:
LoginPlayer(playerid, password[])
{
    if(PlayerLogged[playerid])
        return SendClientMessage(playerid, COLOR_GREY, "You are already logged in!");
    CheckMySQL();
   
    new string[526];
    format(string, sizeof(string), "SELECT * FROM users WHERE name = '%s' AND password = '%s'", playerinfo[playerid][playername], password);
    mysql_query(string);
    mysql_store_result();
   
    if(!mysql_num_rows())
        return SendClientMessage(playerid, COLOR_GREY, "You have typed in the incorrect password");
       
    new row[128];
    new field[14][256];
    mysql_fetch_row_format(row, "|");
    explode(row, field, "|");
    mysql_free_result();
   
    playerinfo[playerid][ID] = strval(field[1]);
    format(playerinfo[playerid][Password], 32, "%s", field[2]);
    playerinfo[playerid][Admin] = strval(field[3]);
    playerinfo[playerid][Money] = strval(field[4]);
    playerinfo[playerid][Bank] = strval(field[5]);
    playerinfo[playerid][Faction] = strval(field[6]);
    playerinfo[playerid][Rank] = strval(field[7]);
    playerinfo[playerid][Skin] = strval(field[8]);
    playerinfo[playerid][first] = strval(field[9]);
    playerinfo[playerid][ban] = strval(field[10]);
    format(playerinfo[playerid][banreason], 256, "%s", field[11]);
    playerinfo[playerid][IP] = strval(field[12]);
    playerinfo[playerid][uid] = strval(field[13]);
    return 1;
}
Anyone see what I am doing wrong?
Reply
#2

Try looking at MySQL logs, it has helped me tons of times.
Reply
#3

There is nothing their in the log.. The only log result I got was 30 minutes ago when the script was working.
Reply
#4

try printf("%s", string);
Reply
#5

Код:
[21:04:44] SELECT * FROM users WHERE name = 'Alex_Zero' AND password = '*********'
Seems to be working, just doesn't seem to be able to go through the rest of the function. It keeps sayings Server: Unknown Command :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)