Mysql Saving issue -
DetoNater - 12.05.2015
Hello there, I have a problem saving things in my mysql database, this is my query code(i don't use threaded queries, )
pawn Код:
new str[700];
mysql_format(mysql,str, sizeof(str),"UPDATE `users` SET Name = %s, IP = %s, Money = %d, Score = %d, Kills = %d, Deaths = %d, Level = %d, Rank = '%s', \
ZonesCaptured = %d, FlagsCaptured = %d, VIP = %d, DonateLevel = %d WHERE ID = %d",PlayerName(playerid),p_IP[playerid],GetPlayerCash(playerid),GetPlayerScore(playerid),Kills[playerid],Deaths[playerid],AdminLevel{playerid},RankNames[Rank[playerid]],ZonesCaptured[playerid],FlagsCaptured[playerid],
VIP[playerid],DonateLevel[playerid],FieldID[playerid]);
mysql_query(mysql,str);
is there a problem saving things if I dont use threaded queries? I coudnt understand. Please help me in this issue.
Re: Mysql Saving issue -
Infamous - 12.05.2015
I'm not great with MySQL but seeing as you're online and waiting i'll give it a go. Try this;
PHP код:
new str[700];
mysql_format(mysql, str, sizeof(str), "UPDATE `users` SET Name = '%s', IP = '%s', Money = '%d', Score = '%d', Kills = '%d', Deaths = '%d', Level = '%d', Rank = '%s', \
ZonesCaptured = '%d', FlagsCaptured = '%d', VIP = '%d', DonateLevel = '%d' WHERE ID = '%d'", PlayerName(playerid), p_IP[playerid], GetPlayerCash(playerid), GetPlayerScore(playerid), Kills[playerid], Deaths[playerid], AdminLevel{playerid}, RankNames[Rank[playerid]], ZonesCaptured[playerid], FlagsCaptured[playerid], VIP[playerid], DonateLevel[playerid], FieldID[playerid]);
mysql_query(mysql, str);
I don't know if AdminLevel{playerid} has curly braces on purpose or not but that's something to check.
Also be sure to check your mysql log file for any issues when saving.
Re: Mysql Saving issue -
DetoNater - 13.05.2015
I'm sorry, this isn't working ..
Re: Mysql Saving issue -
Evocator - 13.05.2015
Код:
new
str[700];
mysql_format(mysql, str, sizeof(str), "UPDATE `users` SET `Name` = '%s', `IP` = '%s', `Money` = '%d', `Score` = '%d', `Kills` = '%d', `Deaths` = '%d', `Level` = '%d', `Rank` = '%s', \
`ZonesCaptured` = '%d', `FlagsCaptured` = '%d', `VIP` = '%d', `DonateLevel` = '%d' WHERE `ID` = '%d'", PlayerName(playerid),
p_IP[playerid],GetPlayerCash(playerid),GetPlayerScore(playerid),Kills[playerid],Deaths[playerid],
AdminLevel{playerid},RankNames[Rank[playerid]],ZonesCaptured[playerid],FlagsCaptured[playerid],
VIP[playerid],DonateLevel[playerid],FieldID[playerid]);
mysql_query(mysql,str);
Also thread the queries. PLEASE.
Re: Mysql Saving issue -
DetoNater - 15.05.2015
Done I've changed that, another doubt is that if we use mysql_format only mysql_tquery can send the formatted query to db? Yet I used a normal query with unformatted strings with mysql_query alone, that time it worked!