Owner name doesn't load [MYSQL]
#1

Hello!

I've got a problem, my car loading system isn't loading the owner name, but it loads everything else.

Код:
public AutoLaadimine()
{
    new rows = cache_num_rows(mysql), count = 0; //let's get the rows and fields from the database.
	if(rows > 0)
    {
    	for(new z = 0; z < rows; z++)
        {
        	for(new i = 0; i < MAX_VEHICLES; i++)
            {
			    MasinaInfo[i][ID] = cache_get_field_content_int(z, "ID");
			    MasinaInfo[i][SQLID] = cache_get_field_content_int(z, "SQLID");
			    cache_get_field_content(z, "Omanik", MasinaInfo[i][Omanik]); // Here is the owner name loading.
			    MasinaInfo[i][Mudel] = cache_get_field_content_int(z, "Mudel");
			    MasinaInfo[i][Lukus] = cache_get_field_content_int(z, "Lukus");
			    MasinaInfo[i][Component][0] = cache_get_field_content_int(z, "Component0");
			    MasinaInfo[i][Component][1] = cache_get_field_content_int(z, "Component1");
			    MasinaInfo[i][Component][2] = cache_get_field_content_int(z, "Component2");
			    MasinaInfo[i][Component][3] = cache_get_field_content_int(z, "Component3");
			    MasinaInfo[i][Component][4] = cache_get_field_content_int(z, "Component4");
			    MasinaInfo[i][Component][5] = cache_get_field_content_int(z, "Component5");
			    MasinaInfo[i][Component][6] = cache_get_field_content_int(z, "Component6");
			    MasinaInfo[i][Component][7] = cache_get_field_content_int(z, "Component7");
			    MasinaInfo[i][Component][8] = cache_get_field_content_int(z, "Component8");
			    MasinaInfo[i][Component][9] = cache_get_field_content_int(z, "Component9");
			    MasinaInfo[i][Component][10] = cache_get_field_content_int(z, "Component10");
			    MasinaInfo[i][Component][11] = cache_get_field_content_int(z, "Component11");
			    MasinaInfo[i][Component][12] = cache_get_field_content_int(z, "Component12");
			    MasinaInfo[i][Component][13] = cache_get_field_content_int(z, "Component13");
			    MasinaInfo[i][Color][0] = cache_get_field_content_int(z, "Color0");
			    MasinaInfo[i][Color][1] = cache_get_field_content_int(z, "Color1");
			    MasinaInfo[i][PaintJob] = cache_get_field_content_int(z, "PaintJob");
			    MasinaInfo[i][vX] = cache_get_field_content_float(z, "vX");
			    MasinaInfo[i][vY] = cache_get_field_content_float(z, "vY");
			    MasinaInfo[i][vZ] = cache_get_field_content_float(z, "vZ");
			    MasinaInfo[i][vR] = cache_get_field_content_float(z, "vR");
			    MasinaInfo[i][Elud] = cache_get_field_content_float(z, "Elud");
			    CreateVehicle(MasinaInfo[i][Mudel], MasinaInfo[i][vX],MasinaInfo[i][vY], MasinaInfo[i][vZ], MasinaInfo[i][vR], MasinaInfo[i][Color][0], MasinaInfo[i][Color][1], -1);
				SetVehicleHealth(MasinaInfo[i][SQLID], MasinaInfo[i][Elud]);
				vCreated[i] = 1;
				count ++;
// Here i print out owner name and sqlid.
				printf("Omanik: %s - SQLID: %d", MasinaInfo[i][Omanik], MasinaInfo[i][SQLID]);
				break;
			}
		}
		printf("Laetud %d autot.", count);
	}
	else
	{
		print("Ьhtegi autot ei laaditud.");
	}
	return 1;
}
It prints out this:
http://prntscr.com/9d82u0

In my database i have owner name inserted.
Reply
#2

be sure in MasinaInfo you have used Omanik with an size to count it as string not numberic example:
enum ...
{
MasinaInfo[MAX_PLAYER_NAME+1];
};
Reply
#3

Quote:
Originally Posted by jlalt
Посмотреть сообщение
be sure in MasinaInfo you have used Omanik with an size to count it as string not numberic example:
enum ...
{
MasinaInfo[MAX_PLAYER_NAME+1];
};
Yes, i have that.
Reply
#4

change
PHP код:
cache_get_field_content(z"Omanik"MasinaInfo[i][Omanik]); 
with:
cache_get_row(row, field_idx, destination[], connectionHandle = 1, max_len = sizeof(destination));
it would be:
PHP код:
cache_get_row(z,The index of the field (starts at '0'),MasinaInfo[i][Omanik],mysql,MAX_PLAYER_NAME+1]; 
change The index of the field (starts at '0') with your Omanik field index
Reply
#5

Quote:
Originally Posted by jlalt
Посмотреть сообщение
change
PHP код:
cache_get_field_content(z"Omanik"MasinaInfo[i][Omanik]); 
with:
cache_get_row(row, field_idx, destination[], connectionHandle = 1, max_len = sizeof(destination));
it would be:
PHP код:
cache_get_row(z,The index of the field (starts at '0'),MasinaInfo[i][Omanik],mysql,MAX_PLAYER_NAME+1]; 
change The index of the field (starts at '0') with your Omanik field index
Cool, it worked!

Thank you very much!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)