Mysql query function question
#6

Actually, what you could do is make it an INSERT query when someone executes the command. Obviously, you'll pass the playerid parameter to the thread function and then you can use mysql_affected_rows() to determine if it was able to add one or not. Example:

pawn Код:
CMD:somequery(playerid, params[])
{
    mysql_function_query(1, "INSERT INTO `values` (`1`, `2`) VALUES(93, 92)", false, "SomeFunction", "d", playerid);
    return 1;
}

public SomeFunction(playerid)
{
    if(playerid != INVALID_PLAYER_ID)
    {
        if(mysql_affected_rows() > 0)
        {
            // it worked
        }
        else
        {
            // it failed
        }
    }
    return 1;
}
Reply


Messages In This Thread
Mysql query function question - by Stefand - 09.05.2013, 10:32
Re: Mysql query function question - by Pooh7 - 09.05.2013, 10:51
Re: Mysql query function question - by Stefand - 09.05.2013, 11:04
Re: Mysql query function question - by LiamM - 09.05.2013, 12:11
Re: Mysql query function question - by Stefand - 09.05.2013, 13:30
Re: Mysql query function question - by Scenario - 09.05.2013, 17:51

Forum Jump:


Users browsing this thread: 1 Guest(s)