problem saving variable
#1

Hello,

There is my code who save the variable Note1:

Код:
format(string, sizeof(string), "UPDATE players SET Note1=%s WHERE id=%d",
PlayerInfo[playerid][pNote1],
PlayerInfo[pSQLID]);
But, I got this error:

Код:
CMySQLHandler::Query(UPDATE players SET Note1= WHERE id=) - An error has occured. (Error ID: 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 'Note2' at line 1)
This is the table:
When I do printf("Note1: %s",PlayerInfo[playerid][pNote1]");, He return None, what I want in my table...

Regards
Reply
#2

PHP код:
UPDATE players SET Note1'%s' WHERE id '%d' 
This ^ should work.

If this doens't work try to debug the string(query).
Reply
#3

How to debug the string(query) please ?

UPDATE players SET Note1= '%s' WHERE id = '%d' don't work :/
Reply
#4

Under this:

PHP код:
format(stringsizeof(string), "UPDATE players SET Note1=%s WHERE id=%d",
PlayerInfo[playerid][pNote1],
PlayerInfo[pSQLID]); 
Код:
printf("%s", string);
Reply
#5

Ok, I got this:

Код:
string: UPDATE players SET Mission=0,Warnings=0,VirWorld=0,Fuel=0,Married=78,MarriedTo=0,FishTool=78,Note1='',Note1s=78,Note2='',Note2s=78,Note3='',Note3s=78,Note4='',Note4s=78,Note5='',Note5s=0,Locked=0 WHERE id=
(NB, it's normal that I got other variable )
Reply
#6

Show me the code of the entire query.
Reply
#7

Код:
 			format(string, sizeof(string), "UPDATE players SET InvWeapon=%d,InvAmmo=%d,Lighter=%d,Cigarettes=%d,RequestingBackup=%d,Roadblock=%d,Mask=%d,Maskuse=%d,HideNumber=%d,Speaker=%d WHERE id=%d",
			PlayerInfo[playerid][pInvWeapon],
			PlayerInfo[playerid][pInvAmmo],
			PlayerInfo[playerid][pLighter],
			PlayerInfo[playerid][pCigarettes],
			PlayerInfo[playerid][pRequestingBackup],
			PlayerInfo[playerid][pRoadblock],
			PlayerInfo[playerid][pMask],
			PlayerInfo[playerid][pMaskuse],
			PlayerInfo[playerid][pHideNumber],
			PlayerInfo[playerid][pSpeaker],
			PlayerInfo[playerid][pSQLID]);
			MySQLCheckConnection();
   			mysql_query(string);
Reply
#8

Quote:
Originally Posted by jcvag44800
Посмотреть сообщение
Код:
 			format(string, sizeof(string), "UPDATE players SET InvWeapon=%d,InvAmmo=%d,Lighter=%d,Cigarettes=%d,RequestingBackup=%d,Roadblock=%d,Mask=%d,Maskuse=%d,HideNumber=%d,Speaker=%d WHERE id=%d",
			PlayerInfo[playerid][pInvWeapon],
			PlayerInfo[playerid][pInvAmmo],
			PlayerInfo[playerid][pLighter],
			PlayerInfo[playerid][pCigarettes],
			PlayerInfo[playerid][pRequestingBackup],
			PlayerInfo[playerid][pRoadblock],
			PlayerInfo[playerid][pMask],
			PlayerInfo[playerid][pMaskuse],
			PlayerInfo[playerid][pHideNumber],
			PlayerInfo[playerid][pSpeaker],
			PlayerInfo[playerid][pSQLID]);
			MySQLCheckConnection();
   			mysql_query(string);
I can't see the 'Note's' here
Reply
#9

Oh, yes sorry

Код:
  			format(string, sizeof(string), "UPDATE players SET Mission=%d,Warnings=%d,VirWorld=%d,Fuel=%d,Married=%d,MarriedTo=%d,FishTool=%d,Note1='%s',Note1s=%d,Note2='%s',Note2s=%d,Note3='%s',Note3s=%d,Note4='%s',Note4s=%d,Note5='%s',Note5s=%d,Locked=%d WHERE id=%d",
			PlayerInfo[playerid][pMissionNr],
			PlayerInfo[playerid][pWarns],
			PlayerInfo[playerid][pVirWorld],
			PlayerInfo[playerid][pMarried],
			PlayerInfo[playerid][pMarriedTo],
			PlayerInfo[playerid][pFishTool],
			PlayerInfo[playerid][pNote1],
			PlayerInfo[playerid][pNote1s],
			PlayerInfo[playerid][pNote2],
			PlayerInfo[playerid][pNote2s],
			PlayerInfo[playerid][pNote3],
			PlayerInfo[playerid][pNote3s],
			PlayerInfo[playerid][pNote4],
			PlayerInfo[playerid][pNote4s],
			PlayerInfo[playerid][pNote5],
			PlayerInfo[playerid][pNote5s],
			PlayerInfo[playerid][pLocked],
			PlayerInfo[playerid][pSQLID]);
			MySQLCheckConnection();
   			mysql_query(string);
Reply
#10

bump !
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)