Jump to content
MakeWebGames

Autoincrement in table user_stat_types


Someone

Recommended Posts

Soo, if I am to add a userStats var with a new module, I should during module activation (enable/disable) do:

SELECT id
FROM `user_stat_types`
ORDER BY `user_stat_types`.`id` DESC
LIMIT 1 

Then use that as a base, add 1 and use that for id for my user_stat_types.id column

Or is there a neat way to do it through the module .sql file?

Link to comment
Share on other sites

Currently you could of course use HIGH ID numbers, for example, use from 1000 to 1100 without querying, so far I doubt somebody is using it. Later on you will be able to have an "install.php" inside the module which will be called during installation and could setup special things like that.

BTW Instead of your query, you could use:

select max(id) from user_stat_types
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...