SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Bloobird's Avatar
    Join Date
    Jan 2005
    Location
    Wales UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unique Number with a year prefix

    Hi

    Im working on an application and each record in my DB has a unique number (auto increment) associated with it. Ive now been asked to put a year in front of each number. E.g 2006-0001, 2006-0002. Then next year 2007-0001, 2007-0002 etc...
    Is there an easy way of acheiving this. At the moment im getting the year by using the PHP function $year = date(Y);

    Any suggestions would be great

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,267
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast Bloobird's Avatar
    Join Date
    Jan 2005
    Location
    Wales UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that. Its made life alot easier. I thought I was gonna have to do a lengthy workaround!

    Thanks again!!


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
  •