phpmyadmin 中的自动增量 [英] Auto increment in phpmyadmin

查看:21
本文介绍了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

这篇关于phpmyadmin 中的自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆