02.07.2016, 14:57 
	
	
	
		Hello guys, i have created a table for houses using mysql, a column called houseid is like:

i wanna know how to get the missing house id (1) to use it in /createhouse command like this:
	
	
	
	

i wanna know how to get the missing house id (1) to use it in /createhouse command like this:
PHP Code:
CMD:createhouse(playerid, params[])
{
    new houseid = GetFreeHouseID();
    // rest of the command ...
    return 1;
}
stock GetFreeHouseID()
{
    for(new i; i < 50; i++)
    {
        new query[128], rows, fields;
        mysql_format(ConnectionHandle, query, sizeof(query),"SELECT * FROM houses WHERE houseid = %i", i);
        mysql_tquery(ConnectionHandle, query, "", "");
        cache_get_data(rows, fields, ConnectionHandle);
        if(!rows) return i;
    }
} 






