22.04.2011, 17:51
I wrote this:
And I got this error:
PHP код:
stock createPropriety( Float:x , Float:y , Float:z , interiorid , vw, type , level , cintid , lock , alarm , price)
{
new str[256], field[6][32];
format( str , 256 , "SELECT * FROM interiorinfo WHERE ID=%d", cintid );
mysql_query(str);
mysql_store_result();
if(mysql_num_rows())
if(mysql_fetch_row(str,"|")) // Splits the row
{
explode(str, field, "|");
}
mysql_free_result();
new a[128], b[128];
format( a , 128 , "INSERT INTO `propertyinfo` (`ID`,`E_X`,`E_Y`,`E_Z`,`E_INT`,`E_VW`,`I_X`,`I_Y`,`I_Z`,`I_INT`,`I_VW`,`TYPE`,`LEVEL`,CASHBOX`,`NAME`,`OWNER`,`CO_OWNER`,`SOLD`,`LOCK`,`ALARM`,`PRICE`)" );
format( b , 128 , " VALUES (NULL,%f,%f,%f,%d,%d,%f,%f,%f,%d,%d,%d,%d,0,'%s','%s','%s',0,%d,%d,%d);",x,y,z,interiorid,vw,floatstr( field[1] ),floatstr( field[2] ),floatstr( field[3] ),strval( field[4] ),strval( field[5] ),type,level,"","","",lock,alarm,price );
format( str , 256 , "%s%s" , a , b );
mysql_query(str);
}
Код:
[Fri Apr 22 14:47:03 2011] Connected (0) to samp @ localhost via TCP/IP. [Fri Apr 22 14:47:03 2011] MySQL Server Version 5.1.41. [Fri Apr 22 14:47:18 2011] Error (0): Failed to exeute query. 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 'VALUES ('NULL',0.000000,0.000000,-13.462181,0,0,2317.847167,-1026.222778,1050.21' at line 1.