MySQL Doesn't load the last row in the database - 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 Doesn't load the last row in the database (
/showthread.php?tid=576437)
MySQL Doesn't load the last row in the database -
SandKing94 - 04.06.2015
Код:
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 ?
Re: MySQL Doesn't load the last row in the database -
iZN - 04.06.2015
why are you doing this?
row index always starts with 0, not 1.
Re: MySQL Doesn't load the last row in the database -
SandKing94 - 04.06.2015
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
Re: MySQL Doesn't load the last row in the database -
jihadmeneer - 04.06.2015
Код:
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.
Re: MySQL Doesn't load the last row in the database -
SandKing94 - 04.06.2015
Thanks i fixed it in another way but still thank you