#1

Код:
        strcat(qstr, "UPDATE `players` SET ");
		strcat(qstr, "`Admin` = %d,");
		strcat(qstr, "`VIP` = %d,");
		strcat(qstr, "`FreeRoam_Score` = %d,");
		strcat(qstr, "`Deathmatch_Score` = %d,");
		strcat(qstr, "`Duel_Score` = %d,");
		strcat(qstr, "`Deaths` = %d,");
        strcat(qstr, "`Skin` = %d,");
		strcat(qstr, "`Pms` = %d,");
		strcat(qstr, "`Gos` = %d,");
		strcat(qstr, "`God` = %d,");
		strcat(qstr, "`Cms` = %d,");
		strcat(qstr, "`MegaJump` = %d,");
		strcat(qstr, "`Color` = %d,");
		strcat(qstr, "`Fighting_Style` = %d,");
		strcat(qstr, "`BanCount` = %d,");
		strcat(qstr, "`JailCount` = %d,");
		strcat(qstr, "`KickCount` = %d,");
		strcat(qstr, "`MuteCount` = %d,");
		strcat(qstr, "`ExplodeCount` = %d,");
		strcat(qstr, "`SlapCount` = %d,");
  		strcat(qstr, "`WeaponRCount` = %d,");
		strcat(qstr, "`Banned` = %d,");
		strcat(qstr, "`Jailed` = %d,");
		strcat(qstr, "`Muted` = %d,");
		strcat(qstr, "`Frozen` = %d,");
		strcat(qstr, "`Time` = %d,");
		strcat(qstr, "`Weather` = %d);
		strcat(qstr, " WHERE ");
		strcat(qstr,"`Account_ID` = %d");
		
	    mysql_format(mysql, query, sizeof(query), qstr,
	    PlayerInfo[playerid][pAdmin],
		PlayerInfo[playerid][pVip],
		PlayerInfo[playerid][pKills],
		PlayerInfo[playerid][pDeathmatchScore],
		PlayerInfo[playerid][DuelScore],
	    PlayerInfo[playerid][pDeaths],
		PlayerInfo[playerid][pSkin],
		PlayerInfo[playerid][Pms],
		PlayerInfo[playerid][Gos],
		God[playerid],
		PlayerInfo[playerid][CMS],
		MegaJump[playerid],
		PlayerInfo[playerid][pColor],
		PlayerInfo[playerid][FightStyles],
		PlayerInfo[playerid][BanC],
		PlayerInfo[playerid][KickC],
		PlayerInfo[playerid][MuteC],
		PlayerInfo[playerid][ExplodeC],
		PlayerInfo[playerid][SlapC],
		PlayerInfo[playerid][WeaponRC],
		PlayerInfo[playerid][pBan],
		PlayerInfo[playerid][Jail],
		PlayerInfo[playerid][pMuted],
		PlayerInfo[playerid][Freeze],
		PlayerInfo[playerid][Time],
	    PlayerInfo[playerid][pWeather],
		PlayerInfo[playerid][Accountid]);
	    mysql_query(mysql, query);
MySQL Log:

Код:
[07:11:54] [DEBUG] CMySQLQuery::Execute - starting query execution
[07:11:54] [ERROR] CMySQLQuery::Execute - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Reply
#2

And where, how do you format those %d ?

Also you have missing ); at the Weather

pawn Код:
strcat(qstr, "`Time` = %d,");
        strcat(qstr, "`Weather` = %d
        strcat(qstr, "
WHERE ");
Reply
#3

Quote:
Originally Posted by ikey07
Посмотреть сообщение
And where, how do you format those %d ?

Also you have missing ); at the Weather

pawn Код:
strcat(qstr, "`Time` = %d,");
        strcat(qstr, "`Weather` = %d
        strcat(qstr, "
WHERE ");
Код:
        strcat(qstr, "UPDATE `players` SET ");
		strcat(qstr, "`Admin` = %d,");
		strcat(qstr, "`VIP` = %d,");
		strcat(qstr, "`FreeRoam_Score` = %d,");
		strcat(qstr, "`Deathmatch_Score` = %d,");
		strcat(qstr, "`Duel_Score` = %d,");
		strcat(qstr, "`Deaths` = %d,");
        strcat(qstr, "`Skin` = %d,");
		strcat(qstr, "`Pms` = %d,");
		strcat(qstr, "`Gos` = %d,");
		strcat(qstr, "`God` = %d,");
		strcat(qstr, "`Cms` = %d,");
		strcat(qstr, "`MegaJump` = %d,");
		strcat(qstr, "`Color` = %d,");
		strcat(qstr, "`Fighting_Style` = %d,");
		strcat(qstr, "`BanCount` = %d,");
		strcat(qstr, "`JailCount` = %d,");
		strcat(qstr, "`KickCount` = %d,");
		strcat(qstr, "`MuteCount` = %d,");
		strcat(qstr, "`ExplodeCount` = %d,");
		strcat(qstr, "`SlapCount` = %d,");
  		strcat(qstr, "`WeaponRCount` = %d,");
		strcat(qstr, "`Banned` = %d,");
		strcat(qstr, "`Jailed` = %d,");
		strcat(qstr, "`Muted` = %d,");
		strcat(qstr, "`Frozen` = %d,");
		strcat(qstr, "`Time` = %d,");
		strcat(qstr, "`Weather` = %d);
		strcat(qstr, " WHERE ");
		strcat(qstr,"`Account_ID` = %d");
		
	    mysql_format(mysql, query, sizeof(query), qstr,
	    PlayerInfo[playerid][pAdmin],
		PlayerInfo[playerid][pVip],
		PlayerInfo[playerid][pKills],
		PlayerInfo[playerid][pDeathmatchScore],
		PlayerInfo[playerid][DuelScore],
	    PlayerInfo[playerid][pDeaths],
		PlayerInfo[playerid][pSkin],
		PlayerInfo[playerid][Pms],
		PlayerInfo[playerid][Gos],
		God[playerid],
		PlayerInfo[playerid][CMS],
		MegaJump[playerid],
		PlayerInfo[playerid][pColor],
		PlayerInfo[playerid][FightStyles],
		PlayerInfo[playerid][BanC],
		PlayerInfo[playerid][KickC],
		PlayerInfo[playerid][MuteC],
		PlayerInfo[playerid][ExplodeC],
		PlayerInfo[playerid][SlapC],
		PlayerInfo[playerid][WeaponRC],
		PlayerInfo[playerid][pBan],
		PlayerInfo[playerid][Jail],
		PlayerInfo[playerid][pMuted],
		PlayerInfo[playerid][Freeze],
		PlayerInfo[playerid][Time],
	    PlayerInfo[playerid][pWeather],
		PlayerInfo[playerid][Accountid]);
	    mysql_query(mysql, query);
Reply
#4

That is such a odd way to do it, use print(query); check if it actually working that way.
If you are using format at all, then dont use strcat.

or do like this

pawn Код:
new string[64],query[1024];
strcat(query, "UPDATE `players` SET ");
format(string,sizeof(string),"`Admin` = '%d', ",PlayerInfo[playerid][pAdmin]); strcat(query,string);
format(string,sizeof(string),"`VIP` = '%d', ",PlayerInfo[playerid][pVip]); strcat(query,string);
format(string,sizeof(string),"`Weather` = '%d' WHERE `Account_ID` = '%d'",PlayerInfo[playerid][Account_ID]); strcat(query,string);
mysql_query(mysql, query);
also in your mysql_query, you use query, while in strcat you use qstr.
Reply
#5

Quote:
Originally Posted by ikey07
Посмотреть сообщение
That is such a odd way to do it, use print(query); check if it actually working that way.
If you are using format at all, then dont use strcat.

or do like this

pawn Код:
new string[64],query[1024];
strcat(query, "UPDATE `players` SET ");
format(string,sizeof(string),"`Admin` = '%d', ",PlayerInfo[playerid][pAdmin]); strcat(query,string);
format(string,sizeof(string),"`VIP` = '%d', ",PlayerInfo[playerid][pVip]); strcat(query,string);
format(string,sizeof(string),"`Weather` = '%d' WHERE `Account_ID` = '%d'",PlayerInfo[playerid][Account_ID]); strcat(query,string);
mysql_query(mysql, query);
also in your mysql_query, you use query, while in strcat you use qstr.
I did the "INSERT INTO" function using strcat and it worked fine
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)