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;
}
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;
}
[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
I believe and could be wrong, but the single quotation mark is used for strings. Not for (floating) integer values.
|
What AndySedeyn said is true, it's not obligatory to use it in integers/floats.
Anyway, your mistake is that you are missing ' VALUES ('%i',%f','%f','%f','%f','%i') |
"INSERT INTO cars (owner,x,y,z,r,model) VALUES (%i,%f,%f,%f,%f,%i)"
"INSERT INTO cars VALUES (NULL,%i,%f,%f,%f,%f,%i)"
In the mysql logs, the error is in "x" field - the one I told you.
pawn Код:
pawn Код:
|
[23:23:10] [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
That MySQL error has nothing to do with the code you have shown us. Show us the corresponding code for that error and we'll try to help you.
|