SA-MP Forums Archive
Error querys - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error querys (/showthread.php?tid=567690)



Error querys - streetpeace - 15.03.2015

I have this errors with querys:
PHP код:
[19:40:05] [ERRORCMySQLQuery::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 ' `HouseOwner`=0, `HouseOwner2`=0, `HouseOwner3`=0 WHERE `ID`=0' at line 1
[19:40:05] [ERRORCMySQLQuery::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 ' `BizOwner`=0, `PermisAuto`=0, `Gun1`=0 WHERE `ID`=0' at line 1
[19:40:05] [ERRORCMySQLQuery::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 ' `JailReason`=, `Kills`=, `Deaths`=0, `FactionID`=0 WHERE `ID`=0' at line 1 
What is the problem please ?


Re : Error querys - streetpeace - 15.03.2015

first:
PHP код:
    mysql_format(mysqlquerysizeof(query), "UPDATE `joueurs` SET `RankJob`=%d, `Suspect`=%d, `SuspectRaison`=%s, `HouseOwner`=%d, `HouseOwner2`=%d, `HouseOwner3`=%d WHERE `ID`=%d"pInfo[playerid][RankJob], pInfo[playerid][Suspect], pInfo[playerid][SuspectRaison], pInfo[playerid][HouseOwner], pInfo[playerid][HouseOwner2], pInfo[playerid][HouseOwner3], pInfo[playerid][ID]);
    
mysql_tquery(mysqlquery""""); 
2nd
PHP код:
    mysql_format(mysqlquerysizeof(query), "UPDATE `joueurs` SET `CarOwner`=%d, `CarOwner2`=%d, `CarOwner3`=%s, `BizOwner`=%d, `PermisAuto`=%d, `Gun1`=%d WHERE `ID`=%d"pInfo[playerid][CarOwner], pInfo[playerid][CarOwner2], pInfo[playerid][CarOwner3], pInfo[playerid][BizOwner], pInfo[playerid][PermisAuto], pInfo[playerid][Gun1], pInfo[playerid][ID]);
    
mysql_tquery(mysqlquery""""); 
3rd
PHP код:
    mysql_format(mysqlquerysizeof(query), "UPDATE `joueurs` SET `JailAdmin`=%s, `JailRaison`=%s, `Kills`=%s, `Deaths`=%d, `FactionID`=%d WHERE `ID`=%d"pInfo[playerid][JailAdmin], pInfo[playerid][JailRaison], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][FactionID], pInfo[playerid][ID]);
    
mysql_tquery(mysqlquery""""); 



Re : Error querys - streetpeace - 16.03.2015

up, need help


Re: Error querys - Darrenr - 16.03.2015

Troubleshoot the SQL syntax...

go into your phpmyadmin and run the SQL code with some dummy data... Just to make sure the sql is correct..

Then using printf() or something... test out the the variables you are putting into the SQL query to make sure they are all correctly set...


Respuesta: Error querys - Victor_Gutierrez - 16.03.2015

PhpMyAdmin will help u better but... check the table's name and column's names

On 3rd code kills=%s, maybe %d?

try with

PHP код:
mysql_format(mysqlquerysizeof(query), "UPDATE `joueurs` SET `JailAdmin`='%s', `JailRaison`='%s', `Kills`=%d, `Deaths`=%d, `FactionID`=%d WHERE `ID`=%d"pInfo[playerid][JailAdmin], pInfo[playerid][JailRaison], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][FactionID], pInfo[playerid][ID]);
    
mysql_tquery(mysqlquery""""); 



Re: Error querys - X337 - 16.03.2015

change
`SuspectRaison`=%s
`CarOwner3`=%s
`JailAdmin`=%s
`JailRaison`=%s
`Kills`=%s
to
Код:
`SuspectRaison`='%s'
Код:
`CarOwner3`='%s'
Код:
`JailAdmin`='%s'
Код:
`JailRaison`='%s'
Код:
`Kills`='%s'
Don't forget single quote for string