Need help with house system [SQLite]
#6

The loop will stop if db_next_row returns 0. I haven't used do-while for that case, I'd do it as:
pawn Код:
new DBResult:Result, rows, hid, Field[21];
Result = db_query(BFU, "SELECT * FROM houses");
rows = db_num_rows(Result);
for (new i; i != rows; ++i)
{
    db_get_field_assoc(Result, "id", Field, 9); hid = strval(Field);
    if (hid >= sizeof (HouseInfo)) break; // if the "hid" is greater than the in-bounds index, stop the loop to prevent run time error 4
    // rest of code.. db_get_field_assoc, create pickup and print the houseid..
    db_next_row(Result);
}
db_free_result(Result);
Reply


Messages In This Thread
Need help with house system [SQLite] - Konstantinos, Pottus - by LocMax - 27.06.2014, 11:09
Re: Need help with house system [SQLite] - by Noliax8 - 27.06.2014, 11:19
Re: Need help with house system [SQLite] - by LocMax - 27.06.2014, 11:42
Re: Need help with house system [SQLite] - by Konstantinos - 27.06.2014, 12:06
Re: Need help with house system [SQLite] - by LocMax - 27.06.2014, 12:31
Re: Need help with house system [SQLite] - by Konstantinos - 27.06.2014, 12:39
Re: Need help with house system [SQLite] - by LocMax - 27.06.2014, 13:22
Re : Need help with house system [SQLite] - by Noliax8 - 27.06.2014, 13:32
Re: Need help with house system [SQLite] - by Pottus - 27.06.2014, 13:41
Re: Need help with house system [SQLite] - by LocMax - 27.06.2014, 13:42

Forum Jump:


Users browsing this thread: 1 Guest(s)