My friend asked: I encountered a problem today. I have created a table and the index is REF. how can I write a piece of information and automatically generate a REF number to record it in the table? The REF number to be generated is continuous, starting from 00000. Obviously, this is a problem that anyone who uses MySQL will encounter.
Recall the MySQL GUI tool mentioned at the time of environment configuration, right, it is, you can find it in http://www.mysql.com. Because sunec is also a programmer, far from reaching the programmer level, it is necessary to use some tools to help ~ I believe some of my friends are the same as me ~
Use a GUI tool to create a table, create a REF field, set REF as the primary key, define the type as int, and check the auto inc option. All right, the work on the MySQL end is over.
Next, I handed it over to PHP. I used the insert command introduced in the previous topic to add data to this table. Note that I do not need to add the REF value because I checked the AUTO INC option, then, each time you add a record, the REF will be automatically generated and will increase in order. in this way, can you meet your needs?
In addition, from this topic, I have summarized some technologies into the PHP technology zone. please pay attention to them!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.