MySQL Doesn't load the last row in the database
#1

Код:
public LoadDoors()
{
	new string[200], i;
    static rows,fields;
	cache_get_data(rows, fields, Connection);
	for(new ii = 0; ii <= rows; ii++)
	{
	    i = ii + 1;
	    Doors++;
        dInfo[i][dIndex] = cache_get_field_content_int(i,"ID");
	    dInfo[i][dPickup] = cache_get_field_content_int(i,"Pickup");
	    dInfo[i][dPos][0] = cache_get_field_content_float(i,"X");
	    dInfo[i][dPos][1] = cache_get_field_content_float(i,"Y");
	    dInfo[i][dPos][2] = cache_get_field_content_float(i,"Z");
	    dInfo[i][dPos][3] = cache_get_field_content_float(i,"XX");
	    dInfo[i][dPos][4] = cache_get_field_content_float(i,"YY");
	    dInfo[i][dPos][5] = cache_get_field_content_float(i,"ZZ");
	    cache_get_field_content(i,"Text",dInfo[i][dText],Connection,64);
    }
    format(string,sizeof(string),"Loaded %d doors",Doors);
    print(string);
    Doorss = Doors;
    SpawnDoors();
    return 1;
}
It loads everything but not the last row in the database and i dont know why is that, can somebody help me ?
Reply
#2

why are you doing this?

Код:
i = ii + 1;
row index always starts with 0, not 1.
Reply
#3

Even without it its the same
i mean if i change
for(new ii = 0; ii <= rows; ii++) to for(new i = 0; i <= rows; i++)
its still the same
Reply
#4

Код:
public LoadDoors()
{
	new string[200];
    static rows,fields;
	cache_get_data(rows, fields, Connection);
	for(new i = 0; i < rows; i++)
	{
	    Doors++;
        dInfo[i][dIndex] = cache_get_field_content_int(i,"ID");
	    dInfo[i][dPickup] = cache_get_field_content_int(i,"Pickup");
	    dInfo[i][dPos][0] = cache_get_field_content_float(i,"X");
	    dInfo[i][dPos][1] = cache_get_field_content_float(i,"Y");
	    dInfo[i][dPos][2] = cache_get_field_content_float(i,"Z");
	    dInfo[i][dPos][3] = cache_get_field_content_float(i,"XX");
	    dInfo[i][dPos][4] = cache_get_field_content_float(i,"YY");
	    dInfo[i][dPos][5] = cache_get_field_content_float(i,"ZZ");
	    cache_get_field_content(i,"Text",dInfo[i][dText],Connection,64);
    }
    format(string,sizeof(string),"Loaded %d doors",Doors);
    print(string);
    Doorss = Doors;
    SpawnDoors();
    return 1;
}
Try this, you were +1 it and this is why it couldn't reach the last row.
Reply
#5

Thanks i fixed it in another way but still thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)