SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    k.. How would i go around choosing a particular "collum" in MySql and all the vaules listed in are sorted alpabeticaly

    lets say I have


    ID | Name | Somevalue |
    1 | apple | b
    2 | zebra | q
    3 | bananna | 21

    pretty crude table huh?
    lets say i want the values rearanged so its

    1 apple b
    3 bananna 21
    2 zebra q

    I want the name collum to be sorted alphabeticly
    Whats the advice oh great php gods!
    (or at least point me in the right direction)
    thanx

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Washington State
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    During your SQL query use ORDER BY fieldname, here's a nice little tutorial on ORDER BY :

    http://linux.oreillynet.com/pub/a/li.../aboutSQL.html

  3. #3
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $sql = mysql_query ("SELECT * FROM $table ORDER BY Name");


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
  •