Auto increment in phpmyadmin

前端 未结 9 2113
暗喜
暗喜 2020-11-28 05:19

I have an existing database using PHP, MySQL and phpMyAdmin.

When users become a member on my website, I need the system to create a unique membership number for the

9条回答
  •  被撕碎了的回忆
    2020-11-28 05:47

    Just run a simple MySQL query and set the auto increment number to whatever you want.

    ALTER TABLE `table_name` AUTO_INCREMENT=10000
    

    In terms of a maximum, as far as I am aware there is not one, nor is there any way to limit such number.

    It is perfectly safe, and common practice to set an id number as a primiary key, auto incrementing int. There are alternatives such as using PHP to generate membership numbers for you in a specific format and then checking the number does not exist prior to inserting, however for me personally I'd go with the primary id auto_inc value.

提交回复
热议问题