SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Sep 2004
    Location
    Oregon
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL Question (Problem Solved)

    -- Problem Solved --

    I use "ID"s for my tables, so when I need to pull from the table, like to get information, I can pull from the ID instead of the actual username. I don't know why, just always have lol.

    Now, I need to have the ID be like:
    0000000001

    Instead of just 1

    I usually do INT(10) primary, auto_increasement and all that fun stuff.

    I jsut need to know how to set it up so either the table will automatically put the 0's, or so I can do so in my PHP script.

    Usually, I will insert into the table without the ID feild, and it will automatically create it with the next number avalible.

    If I do not get a reply pretty soon, like today with a good answer - I will just wait for a friend to get online.
    Last edited by medicjoe95; Jan 8, 2005 at 15:22. Reason: Changing to "Problem Solved"

  2. #2
    Non-Member DaveMichaels's Avatar
    Join Date
    Nov 2004
    Location
    US
    Posts
    535
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using the ZEROFILL attribute.

  3. #3
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    You can set the ZEROFILL attribute of the column.

    Code:
    id INT(10) UNSIGNED ZEROFILL auto_increment PRIMARY KEY
    Yours, Erik.
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  4. #4
    SitePoint Evangelist
    Join Date
    Sep 2004
    Location
    Oregon
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for quick reply.

    Sitepoint rocks xDD


Bookmarks

Posting Permissions

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