Hey guys, I want to generate a unique number in PHP (ex. 000001, 000002 etc), when it is saved in the database it will increment in 1 (+1). But how can I do it? Thank You :)
bLuEmEzzy 0 Junior Poster in Training
Recommended Answers
Jump to PostIn your database if you use
AUTO_INCREMENT
, see here.
Jump to PostIf you set your DB table's primary key to auto increment, you aren't going to be able to set a fixed length of numbers and pad them to the left with zeros. If you want to display it in that format (00000001 vs 1) then you'll have to handle that …
All 5 Replies
mattster 195 Practically a Master Poster Featured Poster
v1shwa 0 Light Poster
JorgeM 958 Problem Solver Team Colleague Featured Poster
diafol
bLuEmEzzy 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.