12.06.2015, 20:50
Hello again i have a problem. My cars don't save in mySQL database the code:
the code to give someone an car:
and the MYSQL log
my table
PHP код:
saveCarToDB(playerid,carid)
{
new query[128];
format(query, sizeof(query), "INSERT INTO cars (owner,x,y,z,r,model) VALUES ('%i',%f','%f','%f','%f','%i')",iInfo[playerid][db_id],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r],cInfo[carid][model]);
mysql_function_query(dbhandel,query,true,"carSaveToDB","i",carid);
return 1;
}
PHP код:
createPlayerCar(playerid, modelid,Float:x, Float:y, Float:z, Float:r)
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][id_x]!=0)continue;
cInfo[i][owner]=iInfo[playerid][db_id];
cInfo[i][c_x]=x;
cInfo[i][c_y]=y;
cInfo[i][c_z]=z;
cInfo[i][c_r]=r;
cInfo[i][id_x] = CreateVehicle(modelid, x,y,z,r, -1, -1, -1);
cInfo[i][model] = modelid;
new string[128];
format(string, sizeof(string), "Automobil cInfo[%i] je napravljeno!",i);
print(string);
saveCarToDB(playerid,i);
return 1;
}
return 1;
}
PHP код:
[22:08:22] [ERROR] CMySQLQuery::Execute[carSaveToDB] - (error #1064) 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 '','-1482.304565','5.468750','121.948730','400')' at line 1
[22:08:57] [ERROR] CMySQLQuery::Execute[] - (error #1064) 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 'WHERE id='0'' at line 1
[22:12:11] [ERROR] CMySQLQuery::Execute[carSaveToDB] - (error #1064) 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 '','-2045.110351','59.643882','345.670837','400')' at line 1
[22:12:28] [ERROR] CMySQLQuery::Execute[] - (error #1064) 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 'WHERE id='0'' at line 1