mysql help
#1

Delete
Reply
#2

Send a query like this: format(string, sizeof(string), "SELECT * FROM warns WHERE name = '%s'", GetPlayerName(params)) and display the result by only the name.
Reply
#3

delete
Reply
#4

pawn Код:
command(getwarnings, playerid, params[])
{
    new Query[100];
    // get the player name
    mysql_format(connectionhandle, Query,sizeof(Query),"SELECT * FROM `warnings` WHERE `Name` = '%s'", name); // Change to your connectionhandle and the table name and field
    mysql_tquery(connectionhandle, Query, true, "DisplayWarnings", "ds", playerid, name);
    return 1;
}

forward DisplayWarnings(playerid, playername[]);
public DisplayWarnings(playerid, playername[])
{
    new rows, fields;
    cache_get_data(rows, fields, cHandle);
    if(rows)
    {
        for(new i = 0; i< rows; i++)
        {
            new chandle[500], reason[128], admin[25], string[500]; // Change the values, they are just random
            cache_get_field_content(i, "Reason", chandle, connectionhandle);
            format(reason,sizeof(reason),"%s",chandle);
           
            cache_get_field_content(i, "Admin", chandle, connectionhandle);
            format(admin,sizeof(reason),"%s",chandle);
           
            format(string,sizeof(string),"%s\nName: %s Reason: %s Admin: %s",string, playername, reason, admin);
            ShowPlayerDialog(playerid, YOUR_DIALOG_ID, DIALOG_STYLE_MSGBOX, "Warnings", string,"Okay","");
    }
    else return SendClientMessage(playerid, -1, "There are no warnings to be shown.");
    return 1;
}
Try this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)