SA-MP Forums Archive
mysql problem - 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: mysql problem (/showthread.php?tid=664395)



mysql problem - bosmania - 27.02.2019

My clan tag won't update in the database

case DIALOG_CLANTAG:
{
if(!response) return SendClientMessage(playerid, COLOR_GREY, "You canceled the clan creation");
new string[128];
PlayerInfo[playerid][pClanRank] = 7;
PlayerInfo[playerid][pClanMember] = 1;
PlayerInfo[playerid][pPremiumPoints] -= 500;
UpdateVariable(playerid, pClanRankx);
UpdateVariable(playerid, pClanMemberx);
UpdateVariable(playerid, pPremiumPointsx);
mysql_format(mysql, szQuery, 256, "INSERT INTO `clans` (`ClanTag`) VALUES ('%e')", inputtext);
new Cache: result = mysql_query(mysql, szQuery);
cache_delete(result);
format(string, sizeof(string), "You've set the clan tag to {0000ff}%s",inputtext);
SendClientMessage(playerid, -1, string);
}


Re: mysql problem - SymonClash - 27.02.2019

You have to use UPDATE instead of INSERT INTO.

pawn Код:
UPDATE clans SET ClanTag = '%e' WHERE ClanID = '%d'", inputtext, YourClanVariable



Re: mysql problem - bosmania - 28.02.2019

Here comes the other problem,i dont know how to set up my clan variable,like how do i do that help please,i ve been trying fooor daays


Re: mysql problem - bosmania - 28.02.2019

i wanna do something like ClanInfo[clanid][cInfo] and i already defined the enums for cinfo but i dont know how to use that clanid,like i don't know how to explain
What i am saying is that i can only create a clan,more than 1 won't update in the data base


Re: mysql problem - bosmania - 28.02.2019

case DIALOG_CLANNAME:
{
new string2[128];
mysql_format(mysql, szQuery, 256, "INSERT INTO `clans` (`ClanName`) VALUES ('%e')", inputtext);
new Cache: result = mysql_query(mysql, szQuery);
new i = cache_insert_id();
cache_delete(result);
PlayerInfo[playerid][pClanid] = i;
UpdateVariable(playerid, pClanidx);
format(string2, sizeof(string2), "Ai setat numele clanului la {ff0000}%s", inputtext);
SendClientMessage(playerid, -1,string2);
ShowPlayerDialog(playerid, DIALOG_CLANTAG, DIALOG_STYLE_INPUT, "Clan tag:", "Choose you clan tag:", "Choose" , "Cancel");

}
case DIALOG_CLANTAG:
{
if(!response) return SendClientMessage(playerid, COLOR_GREY, "Ai renuntat la crearea clanului");
new string[128];
PlayerInfo[playerid][pClanRank] = 7;
PlayerInfo[playerid][pClanMember] = 1;
PlayerInfo[playerid][pPremiumPoints] -= 500;
UpdateVariable(playerid, pClanRankx);
UpdateVariable(playerid, pClanMemberx);
UpdateVariable(playerid, pPremiumPointsx);
mysql_format(mysql, szQuery, 256, "UPDATE `clans` SET `ClanTag` = '%e' WHERE ClanID = '%d'", inputtext, PlayerInfo[playerid][pClanid]);
new Cache: result = mysql_query(mysql, szQuery);
cache_delete(result);
format(string, sizeof(string), "Ai setat tag-ul clanului la {0000ff}%s",inputtext);
SendClientMessage(playerid, -1, string);
}

My clan tag still wont show in the database but the name will