How to check this ? (MySQL)
#1

This doesnt work, but it un-bans (without the rows > 1 part), but I wanted to check if the account was valid....How would I get this to work

pawn Код:
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `PlayerName` = '%s'", string);
    mysql_store_result();
    new rows = mysql_num_rows();
    if(rows > 0)
    {
        TUnbanPlayer(string);
        format(string, sizeof(string), "You have unbanned account(Temp Ban) %s", string);
        SendClientMessage(playerid, COLOUR_REALRED, string);
    }
    if(rows == 0)
    {
        SendClientMessage(playerid, COLOUR_GREY, "There are no accounts found with that name.");
    }
    mysql_free_result();
Reply
#2

pawn Код:
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `PlayerName` = '%s'", string);
    mysql_query(query); // No query line
    mysql_store_result(); // "Error nothing to store"
    new rows = mysql_num_rows();
    if(rows > 0)
    {
        TUnbanPlayer(string);
        format(string, sizeof(string), "You have unbanned account(Temp Ban) %s", string);
        SendClientMessage(playerid, COLOUR_REALRED, string);
    }
    if(rows == 0)
    {
        SendClientMessage(playerid, COLOUR_GREY, "There are no accounts found with that name.");
    }
    mysql_free_result();
Very wrong code...

pawn Код:
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `PlayerName` = '%s'", string);
    mysql_store_result();
    new rows = mysql_num_rows();
    if(rows > 0)
    {
        TUnbanPlayer(string);
        format(string, sizeof(string), "You have unbanned account(Temp Ban) %s", string);
        SendClientMessage(playerid, COLOUR_REALRED, string);
    }
    if(rows == 0)
    {
        SendClientMessage(playerid, COLOUR_GREY, "There are no accounts found with that name.");
    }
    mysql_free_result();
Reply
#3

Ahh, that makes sense, I'm just getting used to mysql!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)