how can I store number like this 000001 in mysql, and increment it everytime a new user register?
Asked
Active
Viewed 2,942 times
2 Answers
6
You can add zerofill
to your (autoincrement
) id column to do what the name suggests. It will make your datatype unsigned
.
see also
2
Try adding ZEROFILL
attribute to the field.
CREATE Table tableName (
mykey int(6) zerofill not null auto_increment,
primary key(mykey)
);
will result every new record:
000001

John Woo
- 258,903
- 69
- 498
- 492