Problem with MySQL
#1

Hey!

I use G-sTyLeZzZ's MySQL plugin, have all the files in the right folders, and the server wrote it could successfully connent to the mysql server, but this function still doesn't work.
I debugged all the 'mysql_num_rows()' value, and all of them were 0.
(One of the last 2 conditions should be true.)

Here's the code:

pawn Код:
function CheckPlayer(playerid)
{
    new query[128];
    format(query,sizeof(query),"SELECT * FROM `banned_ips` WHERE `ip_address` = '%s'",GetIp(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())//ip banned
    {
        Kick(playerid);
        SendClientMessage(playerid,COLOR_ERROR,"Az IP cнmed bannolva van a szerveren!");
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    format(query,sizeof(query),"SELECT * FROM `banned_players` WHERE `username` = '%s'",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())//banned
    {
        Kick(playerid);
        SendClientMessage(playerid,COLOR_ERROR,"A felhasznбlуd bannolva van a szerveren!");
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    format(query,sizeof(query),"SELECT * FROM `users` WHERE `username` = '%s'",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())//regged
    {
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"","[Bejelentkezйs]:\nKйrlek нrd be a jelszavad:","Tovбbb","Kilйpйs");
        mysql_free_result();
        return 1;
    }
    mysql_free_result();
    format(query,sizeof(query),"SELECT * FROM `users` WHERE `username` = '%s'",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(!mysql_num_rows())//not regged
    {
        ShowPlayerDialog(playerid,DIALOG_NOT_REGGED,DIALOG_STYLE_MSGBOX,"","[Nem vagy regisztrбlva!]:\nKйrlek regisztrбlj a\n\n\twww.xyz.hu\n\n\r weboldalon!","Kilйpйs","");
        mysql_free_result();
        return 1;
    }
    return 1;
}
What can be the problem?
Reply
#2

Check the MySQL log? i belive i said this like 50 times all over the forum :S
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)