Click to See Complete Forum and Search --> : Data Type


zuzupus
06-13-2003, 09:49 AM
Hi,

I am using data field Nr. int(10) not null autoinc. in a table
so that when user calls this field he will get this Nr. as 1,2,3---autoincrmenbts whenever he login,but i want some function in PHP so that when user login he will get 001 instead of 1 and 010 instead of 10 not as 0010.

please guide me----

Thanks
zuzupus

AdamGundry
06-14-2003, 01:48 AM
You can do this in the database - in MySQL, you add the attribute ZEROFILL to the column declaration. I presume other databases have similar functionality.

Adam

geen
06-14-2003, 03:30 AM
Or, if u really want to do it through php, use string functions, in a little script.

Regards.
Geen.

www.paginaweb.ro

zuzupus
06-16-2003, 03:42 AM
Hi,

thanks for the help but i am a newbie to PHP and mySQL i tried to use

nr [tinyint(10) or int(10)] [UNSIGNED] [ZEROFILL] [No] [auto_increment ]

and when i give value to nr as 1 it always take as 0000000001

so i dont no how to reduce these much zeroes i want as 001 or please help me to write the function using PHP or how i can directly fill 001 in database.

I will be very thankful ......

Thanks
zuzupus

pyro
06-16-2003, 07:00 AM
You are currently defining the length as 10. Try setting that to 3.

Note: Please do not start new threads on the same topic. The other thread has been deleted.

zuzupus
06-16-2003, 07:15 AM
hi,

i will take care about this new thread actually i am new user ---

thanks