SA-MP Forums Archive
Mysql Error - 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 Error (/showthread.php?tid=620610)



Mysql Error - qUneT - 01.11.2016

Код:
QUERY = INSERT INTO `cars` bla bla ---------------
Код:
forward InsertBuyCar(playerid);
public InsertBuyCar(playerid)
{
    new dest2[128],dest[128];
     new testcar = CreateVehicle(422,-10,-10,-10,0,0,0,-1);
    new vehicleid = testcar;
    DestroyVehicle(testcar);
   	
    new i = cache_insert_id();
   	
    CarsInfo[vehicleid][vID] = cache_get_field_content_int(i, "ID");
    cache_get_field_content(i, "Owner",dest);
    format(CarsInfo[vehicleid][vOwner], 128,dest);
    CarsInfo[vehicleid][vModel] = cache_get_field_content_int(i, "Model");
    CarsInfo[vehicleid][vSpawnX] = cache_get_field_content_float(i, "SpawnX");
    CarsInfo[vehicleid][vSpawnY] = cache_get_field_content_float(i, "SpawnY");
    CarsInfo[vehicleid][vSpawnZ] = cache_get_field_content_float(i, "SpawnZ");
    CarsInfo[vehicleid][vSpawnA] = cache_get_field_content_float(i, "SpawnA");
    CarsInfo[vehicleid][vColor1] = cache_get_field_content_int(i, "Color1");
    CarsInfo[vehicleid][vColor2] = cache_get_field_content_int(i, "Color2");
    .........................................................................
    CarsInfo[vehicleid][vFuel] = cache_get_field_content_int(i, "Fuel");
    CarsInfo[vehicleid][vHealth] = cache_get_field_content_int(i, "Health");
Error:

Код:
In callback "InsertBuyCar"
02:46:11	cache_insert_id	OK	connection: 1
02:46:11	cache_get_field_content_int	OK	row: 0, field_name: "ID", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content	OK	row: 0, field_name: "Owner", connection: 1, max_len: 128
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_int	OK	row: 0, field_name: "Model", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_float	OK	row: 0, field_name: "SpawnX", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_float	OK	row: 0, field_name: "SpawnY", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_float	OK	row: 0, field_name: "SpawnZ", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_float	OK	row: 0, field_name: "SpawnA", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_int	OK	row: 0, field_name: "Color1", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('0')
02:46:11	cache_get_field_content_int	OK	row: 0, field_name: "Color2", connection: 1
...............................................................................................
02:46:11	cache_get_field_content_int	OK	row: 0, field_name: "Fuel", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	cache_get_field_content_int	OK	row: 0, field_name: "Health", connection: 1
02:46:11	CMySQLResult::GetRowDataByName()	ERROR	invalid row index ('1')
02:46:11	CMySQLResult::~CMySQLResult()	OK	deconstructor called
I can't figure it out alone, what's the problem? Row creates succesfully, but it don't load's, what can I do?


Re: Mysql Error - DTV - 01.11.2016

Are you using the latest version of MySQL?


Re: Mysql Error - qUneT - 01.11.2016

MYSQL R33


Re: Mysql Error - Konstantinos - 01.11.2016

Executing an INSERT query will allow you to retrieve the value generated by auto increment but it will NOT select the data for you to retrieve them at the same callback. Honestly, you don't even need to do that - assign the data to the variables at the same place you call the query.


Re: Mysql Error - Micko123 - 01.11.2016

Why don't you use R41??


Re: Mysql Error - qUneT - 06.11.2016

i almost forget about this thred, thank you for the support, i figure it out alone