mysql problem
#1

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);
}
Reply
#2

You have to use UPDATE instead of INSERT INTO.

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

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
Reply
#4

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)