27.11.2013, 16:22
Hello,
I have a problem with my mysql house system.
I am trying to get the next free house id.
But when i use this stock its returning -1 while its needs to return 2 because i am already have houseid 1 in the database.
How can i fix this?
Admigo
I have a problem with my mysql house system.
I am trying to get the next free house id.
But when i use this stock its returning -1 while its needs to return 2 because i am already have houseid 1 in the database.
Код:
stock GetFreeHouseID() { for(new h = 0; h < MAX_HOUSES; h++) { new query[128]; format(query, sizeof(query), "SELECT * FROM `"#MYSQL_HOUSE_TABLE2"` WHERE `HouseID` = '%d'", h); mysql_store_result(); if(mysql_num_rows(gSQL) == 0) { return h; } mysql_free_result(); } return -1; }
Admigo