www.webdeveloper.com
Results 1 to 6 of 6

Thread: Data Type

  1. #1
    Join Date
    Jun 2003
    Posts
    181

    Data Type

    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
    arun krishnan

  2. #2
    Join Date
    Nov 2002
    Location
    Dartmoor [Holiday]
    Posts
    2,382
    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
    "If youíre not using valid HTML, then you havenít created a Web page. You may have created something else, but it isnít a Web page." - Joe Clark

    Do something amazing (USA) | Make Poverty History

  3. #3
    Join Date
    Jun 2003
    Posts
    5
    Or, if u really want to do it through php, use string functions, in a little script.

    Regards.
    Geen.

    www.paginaweb.ro

  4. #4
    Join Date
    Jun 2003
    Posts
    181

    ZEROFILL

    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
    arun krishnan

  5. #5
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    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.

    Personal website http://www.ryanbrill.com/
    Business website: http://www.infinitywebdesign.com/
    TypeSpace http://www.typespace.org/

    I reject your reality and substitute it with my own!

  6. #6
    Join Date
    Jun 2003
    Posts
    181

    thanks

    hi,

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

    thanks
    arun krishnan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles