0

Hi people,

My issue is more of a MySQL issue than php.
I am trying to store a 3digit integer value with a leading Zeros in front such as 001

i have a company table , which auto increments the id as 001, 002, 003...and so on...
In the company table i also have a country radio box..
Which has two country names,
eg: India, Australia..

So when creating the company..
The user types in the data and select a country eg: India,
The Id should be I001,
The next record if he chooses Australia,,, then it will be
A002 ... A003, I004..and so on...till A999(as the last record).

Can anyone help me how to implement this?..

Ur help is much appreciated...
Thanks in advance..

3
Contributors
4
Replies
9
Views
7 Years
Discussion Span
Last Post by axelotl
1

AUTO_INCREMENT can only be numeric. For leading zeros you can set the field to ZEROFILL.You should concatenate character while displaying the data.

0

AUTO_INCREMENT can only be numeric. For leading zeros you can set the field to ZEROFILL.You should concatenate character while displaying the data.

Hi mwasif,

Thanks, i used as numeric field and used Zerofill..
It helped me a lot..
Thanks again

0

I just had this exact problem with tel numbers having a leading zero - 011 123 4567 would be stored as 11 123 4567.

These numbers are entered from a php online form.

I checked the DB field for tel_number which is VARCHAR with length 12 and saw that it was missing the collation parameter - this was blank.

Changing that to " latin1_swedish_ci" seems to have fixed the problem.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.