MySQL/R33
#1

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:
PHP Code:
CMD:createhouse(playeridparams[])
{
    new 
houseid GetFreeHouseID();
    
// rest of the command ...
    
return 1;
}
stock GetFreeHouseID()
{
    for(new 
i50i++)
    {
        new 
query[128], rowsfields;
        
mysql_format(ConnectionHandlequerysizeof(query),"SELECT * FROM houses WHERE houseid = %i"i);
        
mysql_tquery(ConnectionHandlequery"""");
        
cache_get_data(rowsfieldsConnectionHandle);
        if(!
rows) return i;
    }

Reply


Messages In This Thread
MySQL/R33 - by Juvanii - 02.07.2016, 14:57
Re: MySQL/R33 - by Vince - 02.07.2016, 15:00
Re: MySQL/R33 - by Juvanii - 02.07.2016, 15:24
Re: MySQL/R33 - by SecretBoss - 02.07.2016, 15:27
Re: MySQL/R33 - by Konstantinos - 02.07.2016, 15:50
Re: MySQL/R33 - by Juvanii - 02.07.2016, 16:32
Re: MySQL/R33 - by [cS]Owain - 02.07.2016, 16:41

Forum Jump:


Users browsing this thread: 1 Guest(s)