[Help] Failed mySQL Query.
#1

I wrote this:

PHP код:
stock createProprietyFloat:Float:Float:interiorid vw,  type level cintid lock alarm price)
{
    new 
str[256], field[6][32];
    
formatstr 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(strfield"|");
        }
    
mysql_free_result();
    new 
a[128], b[128];
    
format128 "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`)" );
    
format128 " 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,floatstrfield[1] ),floatstrfield[2] ),floatstrfield[3] ),strvalfield[4] ),strvalfield[5] ),type,level,"","","",lock,alarm,price );
    
formatstr 256 "%s%s" );
    
mysql_query(str);

And I got this error:
Код:
[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.
Reply
#2

pawn Код:
stock createPropriety( Float:x , Float:y , Float:z , interiorid , vw,  type , level , cintid , lock , alarm , price)
{
    new str[500], field[6][32];
    format( str , sizeof str , "SELECT * FROM interiorinfo WHERE ID=%d", cintid );
    mysql_query(str);
    mysql_store_result();
    if(mysql_num_rows()) {
      if(mysql_fetch_row(str,"|")) {
            explode(str, field, "|");
      }
    }
    mysql_free_result();
    format( str , sizeof str , "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`) \
    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 );
    mysql_query(str);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)