您好,欢迎来到微智科技网。
搜索
您的当前位置:首页python 生成001开始的序号,自动生成的序列号从001开始(仅3位)-PHP / MYSQL

python 生成001开始的序号,自动生成的序列号从001开始(仅3位)-PHP / MYSQL

来源:微智科技网

I need Auto generated sequence number staring from 001 ONLY FOR 3 DIGITS in PHP / MYSQL

ex: 001 next will be 002 and next will be 003 ... 009 .. 010 ..119..120..etc but number generated should be in sequence wise not like 001 then 120 or 008 etc , i need in sequence number.

actually i have product tracking system . where i need mixer of my main product id + auto sequence number ( only 3 digit can change if wanted ) hence my final product id becomes :

111-001 , 111-002 , 111-003 , 111-004 ....etc

Note: this auto sequence number will be insert in my mysql database ( after ADD button follows by Update query ( hence my auto sequence will be enter in database with Update query ))

解决方案

Just add the length 3 and zerofill to your id column.

ALTER TABLE `YOUR_TABLE` CHANGE

`id_column` `id_column` INT( 3 ) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 7swz.com 版权所有 赣ICP备2024042798号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务