Auto increment in phpmyadmin(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 中的自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:phpmyadmin 中的自动增量


基础教程推荐
- php中的PDF导出 2022-01-01
- php中的foreach复选框POST 2021-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- Web 服务器如何处理请求? 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01