SA-MP Forums Archive
mysql_tquery Tag Mismatch - 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: mysql_tquery Tag Mismatch (/showthread.php?tid=663334)



mysql_tquery Tag Mismatch - akib - 28.01.2019

Code
PHP код:
CMD:adddealer(playerid,params[]){
    new 
Float:x,Float:y,Float:z,dname[32],m[512];
    if(
sscanf(params, "s[32]", dname)) return SendClientMessage(playerid, COLOR_GREY, "Usage:{FFFFFF} /adddealer [Name]");
    
GetPlayerPos(playerid, x,y,z);
    for(new 
i=1;i<MAX_DEALERSHIP;i++){
        if(!
DealerInfo[i][dealer_id]){
            
DealerInfo[i][dealer_id]=i;
            
DealerInfo[i][dealer_pos][0] = x;
            
DealerInfo[i][dealer_pos][1] = y;
            
DealerInfo[i][dealer_pos][2] = z;
            
DealerInfo[i][dealer_pickup] = CreateDynamicPickup(1318, 23, x,y,z);
            
            
format(DealerInfo[i][dealer_name], 32, "%s", dname);
            
mysql_format(dbhandle, m, sizeof(m), "INSERT INTO dealerships (x,y,z,name) VALUES ('%f','%f','%f','%s')", DealerInfo[i][dealer_pos][0],DealerInfo[i][dealer_pos][1],DealerInfo[i][dealer_pos][2],DealerInfo[i][dealer_name]);
            new 
Cache:result = mysql_function_query(dbhandle,m,false,"","");
            
DealerInfo[i][dealer_sqlid]=cache_insert_id();
            
cache_delete(result);
            
format(m, sizeof(m), "You have successfully created dealership id %i [SQLID : %i]", DealerInfo[i][dealer_id],DealerInfo[i][dealer_sqlid]);
            
SendClientMessage(playerid, COLOR_GREEN, m);
            return 
1;
        }
    }
    return 
1;
} 
Error Line
PHP код:
mysql_format(dbhandle, m, sizeof(m), "INSERT INTO dealerships (x,y,z,name) VALUES ('%f','%f','%f','%s')", DealerInfo[i][dealer_pos][0],DealerInfo[i][dealer_pos][1],DealerInfo[i][dealer_pos][2],DealerInfo[i][dealer_name]);
            new 
Cache:result = mysql_function_query(dbhandle,m,false,"","");
            
DealerInfo[i][dealer_sqlid]=cache_insert_id(); 
Also not getting insert_id();


Re: mysql_tquery Tag Mismatch - Banditul18 - 28.01.2019

The mysql_tquery execute the query in other thread and call a specified callback where return the result
What you looking for is mysql_query


Re: mysql_tquery Tag Mismatch - akib - 28.01.2019

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
The mysql_tquery execute the query in other thread and call a specified callback where return the result
What you looking for is mysql_query
Sorry wrong code pasted, i tried with this
PHP код:
mysql_format(dbhandle, m, sizeof(m), "INSERT INTO dealerships (x,y,z,name) VALUES ('%f','%f','%f','%s')", DealerInfo[i][dealer_pos][0],DealerInfo[i][dealer_pos][1],DealerInfo[i][dealer_pos][2],DealerInfo[i][dealer_name]);
            new 
Cache:result = mysql_tquery(dbhandle, m); 
and got error

I tried with pquery tquery both