SA-MP Forums Archive
Find number not working, MYSQL. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Find number not working, MYSQL. (/showthread.php?tid=609376)



Find number not working, MYSQL. - Dokins - 11.06.2016

pawn Code:
format(query, sizeof(query), "SELECT `PlayerName`,`Number` FROM `accounts` WHERE `PlayerName` LIKE '%%%s%%'", player);
    mysql_tquery(dbHandle, query,"FoundNumber", "i", playerid);
    return 1;
}
forward FoundNumber(playerid);
public FoundNumber(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    new string[512], result[64];
    new name[32], number;
    if(rows)
    {
        for(new x; x < rows; x++)
        {
            cache_get_row(x, 0, name);
            number = cache_get_row_int(x, 1);
            if(number > 0)
            {
                format(result, sizeof(result), "%s | Number: %d", name, number);
                strcat(string, result);
            }
        }
        SendClientMessage(playerid, COLOUR_WHITE, string);
    }
    if(!rows)
    {
        return SendClientMessage(playerid, COLOUR_GREY, "No numbers found with that name.");
    }
    return 1;
}
It seems to send a blank message when used, it only works briefly. It's very odd.


Re: Find number not working, MYSQL. - coole210 - 12.06.2016

Which version of MySQL is this?