28.01.2019, 14:27
Code
Error Line
Also not getting insert_id();
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;
}
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();