How do I get the result from MySQL without returning it?
#1

How do I do something like this:

Although this works, it only returns the first digit of the number, how do I manage to make it display all?

pawn Код:
CMD:findnumber(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(Phonebook[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You do not have a phonebook, you can buy one from a store.");
    new player[24],string[128], number[16], query[256];
    if(sscanf(params, "s[24]",player)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /findnumber [player name]");
   
   
    format(query, sizeof(query), "SELECT `Number` FROM `accounts` WHERE `PlayerName` = '%s'", player);
    mysql_query(query); // No query line
    number = mysql_store_result(); // "Error nothing to store"
    new rows = mysql_num_rows();
    if(rows > 0)
        {
            format(string, sizeof(string), "%s - %d", player, number);
            SendClientMessage(playerid, COLOUR_WHITE, string);
        }
    if(rows == 0)
        {
            SendClientMessage(playerid, COLOUR_GREY, "There was no numbers found with that name.");
        }
        mysql_free_result();
    return 1;
}
Reply
#2

explain more... what do u mean first digit without returning it ? use float or limit ?
Reply
#3

Basically, how do I make the mysql_store_result display the result, because it's not doing it correctly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)