Mysql - (error #1064)
#1

Hello all guys, how are you going? and yeah, the problem which I don't really like, but it finally fallen on me

I tried solving this by myself, but without result..


mysql_log :
PHP код:
[19:32:29 02/04/18] [ERRORCMySQLQuery::Execute[] - (error #1064) Erreur de syntaxe prиs de 'Rename = 0 WHERE ID = 0' а la ligne 1 (Query: "UPDATE srv_users SET Niveau = 1, Respect = 5, ServiceMinute = 0, MinExp = 1, AdminLevel = 10012, Banexp = 0, Banm = 0, Bany = 0, Banhour = 0, Banmin = 0, RaisonBanni = '', VIP = 0, Rename = 0 WHERE ID = 0") 
server_log :
PHP код:
[19:31:38UPDATE srv_users SET Niveau 1Respect 1ServiceMinute 0MinExp 0AdminLevel 10012Banexp 0Banm 0Bany 0Banhour 0Banmin 0RaisonBanni ''VIP 0Rename 0 WHERE ID 
Script :
Код:
Users_Save(userid)
{

	static
 		query[5054];

	format(query,sizeof(query), "UPDATE srv_users SET Niveau = %d, Respect = %d, ServiceMinute = %d, MinExp = %d, AdminLevel = %d, Banexp = %d, Banm = %d, Bany = %d, Banhour = %d, Banmin = %d, RaisonBanni = '%s', VIP = %d, Rename = %d WHERE ID = %d",
 	PlayerInfo[userid][pNiveau],
  	PlayerInfo[userid][pRespect],
 	PlayerInfo[userid][pServiceMinute],
   	PlayerInfo[userid][pMinExp],
   	PlayerInfo[userid][pAdminLevel],
    PlayerInfo[userid][pBanexp],
    PlayerInfo[userid][pBanm],
    PlayerInfo[userid][pBany],
    PlayerInfo[userid][pBanhour],
    PlayerInfo[userid][pBanmin],
    PlayerInfo[userid][pRaisonBanni],
    PlayerInfo[userid][pVIP],
    PlayerInfo[userid][pRename],
	PlayerInfo[userid][pID]);
	mysql_tquery(g_iHandle, query, "", "");
}
Can anyone give me a bit of help please
Reply
#2

No english translation please? Although did you search around before posting? I bet this error happened with many people..
Reply
#3

Here's an example
Unfortunately, I can't see where's the wrong with my code..
And my code doesn't update anything on database due to this error
Reply
#4

which version of MySQL u're using?
Reply
#5

I really appreciate your help guys with me
Problem fixed!

If we looked at this code we can see that there exist two errors :
- the first one, which is calling
Код:
....(error #1064)
- the second
Код:
(....WHERE ID = 0)
# ID = 1 (Which is my ID on database)

Solution :
- Remplaced by :
Код:
UPDATE `srv_users` SET `Niveau` = '%d', `Respect` = '%d', `ServiceMinute` = '%d', `MinExp` = '%d', `AdminLevel`= '%d', `Banexp`= '%d', `Banm`= '%d', `Bany`= '%d', `Banhour`= '%d', `Banmin` = '%d', `RaisonBanni` = '%s', `VIP` = '%d', `Rename` = '%d' WHERE `ID` = '%d'
-
Before :

Код:
public CheckAccount(playerid) //That's the public I call when a player is connecting to check if he's/not registred
{
	new rows,
	fields,
	string[144];

	cache_get_data(rows, fields);
	if(!rows)
	{
		//Not registred
	}
	else //Reigstred, so we're going to load his information
	{
        	PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID"); 
        }
	return 1;
}
The correct one :

Код:
public CheckAccount(playerid) //That's the public I call when a player is connecting to check if he's/not registred
{
	new rows,
	fields,
	string[144];

	cache_get_data(rows, fields);
	if(!rows)
	{
		//Not registred
	}
	else //Reigstred, so we're going to load his information
	{
		for(new iSlot, count_nb = cache_get_row_count(); iSlot < count_nb; iSlot++)
		{
        		PlayerInfo[playerid][pID] = cache_get_field_content_int(iSlot, "ID");
        	}
	}
	return 1;
}
Reply
#6

Rename is a reserved keyword in SQL, that's why "`" helped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)