phpmyadmin 中的自动增量

2022-01-05 00:00:00 php phpmyadmin

我有一个使用 PHP、MySQL 和 phpMyAdmin 的现有数据库.

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

当用户成为我网站的会员时,我需要系统使用五位数字为他们创建一个唯一的会员编号.例如 83773.我想这就像生成一个随机密码,除了我只想要我的成员的数字.此 ID 号对于每个成员必须是唯一的.

When users become a member on my website, I need the system to create a unique membership number for them using a five digit number. for e.g 83773. I guess it is like generating a random password except I only want numbers for my members. This ID number has to be unique to each member.

是否可以在我的用户表中将主键设置为 auto_increment 并将其设置为从 10000 开始,然后在每次会员注册时自动递增?

Would it be possible for me to set the primary key to auto_increment in my user table and set it to start at 10000 and then auto increment every time a member registers?

另外,主键 ID 号有没有上限?

Also, is there a maximum number that the primary key ID number would go up to?

这是将主键 ID 号用作会员号的可靠且安全的方法吗?

Is this a reliable and safe way to use the primary key ID number as a membership number?

推荐答案

为列启用自动增量的可能步骤.我猜 phpMyAdmin 版本是 3.5.5 但不确定.

There are possible steps to enable auto increment for a column. I guess the phpMyAdmin version is 3.5.5 but not sure.

点击表格 > 结构标签>在操作下单击主要(设置为主要),点击弹出窗口中的更改,向左滚动并选中A_I.还要确保您为默认无这里">

Click on Table > Structure tab > Under Action Click Primary (set as primary), click on Change on the pop-up window, scroll left and check A_I. Also make sure you have selected None for Default

相关文章