Mysql - (error #1064) -
Maximun - 04.02.2018
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] [ERROR] CMySQLQuery::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:38] UPDATE srv_users SET Niveau = 1, Respect = 1, ServiceMinute = 0, MinExp = 0, AdminLevel = 10012, Banexp = 0, Banm = 0, Bany = 0, Banhour = 0, Banmin = 0, RaisonBanni = '', VIP = 0, Rename = 0 WHERE ID = 0
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
Re: Mysql - (error #1064) -
JasonRiggs - 04.02.2018
No english translation please? Although did you search around before posting? I bet this error happened with many people..
Re: Mysql - (error #1064) -
Maximun - 04.02.2018
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
Re: Mysql - (error #1064) -
Mugala - 04.02.2018
which version of MySQL u're using?
Re: Mysql - (error #1064) -
Maximun - 04.02.2018
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
- the second
# 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;
}
Re: Mysql - (error #1064) -
Misiur - 05.02.2018
Rename is a reserved keyword in SQL, that's why "`" helped.