SQL sintax error
#1

PHP код:
                    new Float:APosX,Float:APosY,Float:APosZ,string[128];
                    
GetPlayerPos(playerid,APosX,APosY,APosZ);
                    
mysql_format(sql,string,sizeof(string),"INSERT INTO `houses` ( `ExteriorX`, `ExteriorY`, `ExteriorZ`, `InteriorX`, `InteriorY`, `InteriorZ`) VALUES ('%f','%f','%f',140.17,1336.06,1083.65)",APosX,APosY,APosZ);
                    
mysql_tquery(sql,string,"",""); 
Код:
[19:39:27] [DEBUG] mysql_format - connection: 1, len: 128, format: "INSERT INTO `houses` ( `ExteriorX`, `ExteriorY`, `ExteriorZ`, `InteriorX`, `InteriorY`, `InteriorZ`) VALUES ('%f','%f','%f',140...."
[19:39:27] [ERROR] mysql_format - destination size is too small
[19:39:27] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `houses` ( `ExteriorX`, `ExteriorY`, `ExteriorZ`, `I", callback: "(null)", format: "(null)"
[19:39:27] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[19:39:27] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''939.337' at line 1
[19:39:27] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
Reply
#2

increase string size
Reply
#3

every value involved in a mysql query should be enclosed with a double ' on the beginning and the ending of the value;

Код:
mysql_format(sql,string,sizeof(string),"INSERT INTO `houses` ( `ExteriorX`, `ExteriorY`, `ExteriorZ`, `InteriorX`, `InteriorY`, `InteriorZ`) VALUES ('%f','%f','%f','140.17,1336.06','1083.65')",APosX,APosY,APosZ);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)