GetFreeHouseID Mysql
#1

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.
Код:
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;
}
How can i fix this?

Admigo
Reply


Messages In This Thread
GetFreeHouseID Mysql - by Admigo - 27.11.2013, 16:22
Re: GetFreeHouseID Mysql - by Kyle - 27.11.2013, 16:25
Re: GetFreeHouseID Mysql - by Konstantinos - 27.11.2013, 16:30
Re: GetFreeHouseID Mysql - by Admigo - 27.11.2013, 16:35
Re: GetFreeHouseID Mysql - by Jefff - 27.11.2013, 16:47

Forum Jump:


Users browsing this thread: 1 Guest(s)