17.10.2013, 14:46
Hello, i made code:
And in MySQL log i get this:
Why I get error in this line:
and this line is correct:
Код:
if(pInfo[playerid][m1id] != 0) { new Float:vehx, Float:vehy, Float:vehz, Float:veha, vid1; GetVehiclePos(pInfo[playerid][m1id], vehx, vehy, vehz); GetVehicleZAngle(pInfo[playerid][m1id], veha); vid1 = pInfo[playerid][m1id]; MySQLCheck(); format(query, sizeof(query), "UPDATE `cars` SET x = %f WHERE savininkas = '%s' AND kiekis = %i", vehx, GetPlayerNameEx(playerid), v); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET y = %f WHERE savininkas = '%s' AND kiekis = %i", vehy, GetPlayerNameEx(playerid), v); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET z = %f WHERE savininkas = '%s' AND kiekis = %i", vehz, GetPlayerNameEx(playerid), v); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET a = %f WHERE savininkas = '%s' AND kiekis = %i", veha, GetPlayerNameEx(playerid), v); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET `lock` = '%i' WHERE `savininkas` = '%s' AND' `kiekis` = '1'", vInfo[vid1][lock], GetPlayerNameEx(playerid)); mysql_query(query); mysql_free_result(); } if(pInfo[playerid][m2id] != 0) { new Float:vehx, Float:vehy, Float:vehz, Float:veha, vid2; GetVehiclePos(pInfo[playerid][m2id], vehx, vehy, vehz); GetVehicleZAngle(pInfo[playerid][m2id], veha); vid2 = pInfo[playerid][m2id]; MySQLCheck(); format(query, sizeof(query), "UPDATE `cars` SET x = %f WHERE savininkas = '%s' AND kiekis = %i", vehx, GetPlayerNameEx(playerid), d); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET y = %f WHERE savininkas = '%s' AND kiekis = %i", vehy, GetPlayerNameEx(playerid), d); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET z = %f WHERE savininkas = '%s' AND kiekis = %i", vehz, GetPlayerNameEx(playerid), d); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET a = %f WHERE savininkas = '%s' AND kiekis = %i", veha, GetPlayerNameEx(playerid), d); mysql_query(query); format(query, sizeof(query), "UPDATE `cars` SET `lock` = '%i' WHERE `savininkas` = '%s' AND `kiekis` = '2'", vInfo[vid2][lock], GetPlayerNameEx(playerid)); mysql_query(query); mysql_free_result(); }
Код:
[17:51:07] CMySQLHandler::Query(UPDATE `cars` SET x = -179.247222 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 1) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET y = 1222.178588 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 1) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET z = 19.306741 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 1) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET a = 198.525039 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 1) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET `lock` = '2' WHERE `savininkas` = 'Cristiano_Fernandes' AND' `kiekis` = '1') - An error has occured. (Error ID: 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 '1'' at line 1) [17:51:07] >> mysql_free_result( Connection handle: 1 ) [17:51:07] CMySQLHandler::FreeResult() - The result is already empty. [17:51:07] >> mysql_reconnect( Connection handle: 1 ) [17:51:07] CMySQLHandler::Ping() - Connection is still alive. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET x = -171.474334 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 2) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET y = 1214.454956 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 2) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET z = 19.405532 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 2) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET a = 271.850555 WHERE savininkas = 'Cristiano_Fernandes' AND kiekis = 2) - Successfully executed. [17:51:07] >> mysql_query( Connection handle: 1 ) [17:51:07] CMySQLHandler::Query(UPDATE `cars` SET `lock` = '2' WHERE `savininkas` = 'Cristiano_Fernandes' AND `kiekis` = '2') - Successfully executed.
Код:
format(query, sizeof(query), "UPDATE `cars` SET `lock` = '%i' WHERE `savininkas` = '%s' AND' `kiekis` = '1'", vInfo[vid1][lock], GetPlayerNameEx(playerid));
Код:
format(query, sizeof(query), "UPDATE `cars` SET `lock` = '%i' WHERE `savininkas` = '%s' AND `kiekis` = '2'", vInfo[vid2][lock], GetPlayerNameEx(playerid));