Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    66
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Unhappy newb question about ORDER BY

    Hello.

    I would like to know how to order something alphabetically.
    I have made a database with lyrics - song titles and words. And I have made it so the page lists all the songs that are there, but i would like to know how to sort the alphabetically.
    Here is a sample of the code!

    PHP Code:
     
    // show lyrics list

       
    $result mysql_query("SELECT * FROM lyrics ORDER BY title ??? ",$db);

        if (
    $myrow mysql_fetch_array($result)) { 
    Thank you very much!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    183
    Thanks
    0
    Thanked 0 Times in 0 Posts
    $result = mysql_query("SELECT * FROM lyrics ORDER BY title ASC",$db);

    That'll list them a, b, c, etc.

    $result = mysql_query("SELECT * FROM lyrics ORDER BY title DESC",$db);

    That'll list them z,y,x, etc.

    Offtone.com - In the works...


  •  

    Posting Permissions

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