1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Sort by alphabet instead of nr?

Discussion in 'PHP' started by Johnburk, Oct 22, 2006.

  1. #1
    I have a link script that displays all links based on link nr instead of alphabet.
    Every time I add a link, in the mysql database the link gets a nr and when it is displayed it will show the links based on those nrs. So the first link entered will be on top and then the second link entered and so on.

    What php command needs to be used to have the links sorted by alphabet?
     
    Johnburk, Oct 22, 2006 IP
  2. Chemo

    Chemo Peon

    Messages:
    146
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    IMO, you should sort them with MySQL (or whatever DB you're using) and not PHP. Maybe you could post the actual SQL statement and someone can help you get it "sorted" out. :)

    Bobby
     
    Chemo, Oct 22, 2006 IP
    Bram Wenting likes this.
  3. Bram Wenting

    Bram Wenting Active Member

    Messages:
    392
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    68
    #3
    Use this:

    SELECT * FROM `tablename` ORDER BY `linkname` DESC

    It orders your links by their name...
     
    Bram Wenting, Oct 22, 2006 IP
    Chemo likes this.
  4. PwrUps

    PwrUps Peon

    Messages:
    377
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That's if you want it to go from Z - A...

    Replace DESC with ASC if you want it to go from A - Z
     
    PwrUps, Oct 22, 2006 IP
  5. Johnburk

    Johnburk Peon

    Messages:
    777
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you :D :D

    This was exactly what I was looking for :D
     
    Johnburk, Oct 22, 2006 IP