MYSQL help needed
#3

Hi
You can try this:

Код:
mysql_tquery(g_SQL,"SELECT u.Id + 1 AS FirstAvailableId FROM `yourtable` u LEFT JOIN `yourtable` u1 ON ul.Id = u.Id + 1 WHERE u1.Id IS NULL ORDER BY u.Id LIMIT 0, 1" , "sql_FirstNextID", "i",playerid);
Код:
forward sql_FirstNextID(playerid);
public sql_FirstNextID(playerid)
{
new i,query[128];
cache_get_value_name_int(0, "FirstAvailableId",i);
mysql_format(g_SQL, query,sizeof(query),"INSERT INTO `yourtable` (`id`) VALUES ('%i')",i);
mysql_tquery(g_SQL, query);
...
return 1;
}
Reply


Messages In This Thread
MYSQL help needed - by m4karow - 12.08.2018, 14:45
Re: MYSQL help needed - by Akeem - 12.08.2018, 14:48
Re: MYSQL help needed - by GospodinX - 12.08.2018, 15:26
Re: MYSQL help needed - by DAKYSKYE - 12.08.2018, 16:50
Re: MYSQL help needed - by m4karow - 12.08.2018, 18:30
Re: MYSQL help needed - by m4karow - 18.08.2018, 13:25

Forum Jump:


Users browsing this thread: 1 Guest(s)