SA-MP Forums Archive
[HELP] Write text to SQL Database - 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: [HELP] Write text to SQL Database (/showthread.php?tid=373070)



[HELP] Write text to SQL Database - RedJohn - 29.08.2012

Hey. How'd I could write to SQL database my tag I selected using:
pawn Код:
COMMAND:tag(playerid, params[])
{
    new
        string[128],
        text
    ;
    if(sscanf(params, "s[30]", text)) return SendClientMessage(playerid, LIGHTBLUE, "[USAGE]: /tag [tag]");
    format(string, sizeof(string), "%s", text);
    GivePlayerTag(playerid, string);
    return 1;
}
pawn Код:
stock GivePlayerTag(playerid, tag[])
{
    new string[30];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(string, sizeof(string), "[%s] %s", tag, pName);
    SetPlayerName(playerid, string);
    return 1;
}
I done my SQL system using this tutorial: https://sampforum.blast.hk/showthread.php?tid=278188

Thanks.


Re: [HELP] Write text to SQL Database - Sinner - 29.08.2012

Query to add the column:

Код:
ALTER `your_table_name` ADD COLUMN `tag` VARCHAR(30)
Query to insert a tag in the database:

Код:
UPDATE `your_table_name` SET `tag` = 'your_tag' WHERE `NAME` = 'your_username'



Re: [HELP] Write text to SQL Database - RedJohn - 29.08.2012

Can't make it working.


Re: [HELP] Write text to SQL Database - RedJohn - 29.08.2012

BUMP