Results 1 to 2 of 2

Thread: arranging mysql data

  1. #1
    Join Date
    Mar 2007
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default arranging mysql data

    hi i have a table which has a field called month whose values are
    January,February,March etc in no particular order

    i am selecting all daya from this table and the month values are in the following order:
    January
    November
    December
    February
    March
    April
    May
    June
    July
    August
    September
    October

    i want it to be displayed in the proper order
    January
    February
    March
    ..
    ..
    ..
    December

    Can some1 please help me with this.
    Thanks in advance
    Suk

  2. #2
    Join Date
    Jun 2009
    Posts
    62
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default

    Well...now I am new at PHP/MySQL...but from my understanding...
    Make a new field called "id". Then assign January the id 1, February the id 2, and so on.
    Then you can do:
    PHP Code:
    $result mysql_query("SELECT * FROM months ORDER BY id"); 

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
  •