SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm working on the links script in PHP and MySQL at the moment, I've got all (or most of) the basic out of the way, but I want to set it up so that the results of the query are sorted in assending order.

    The query i'm using at the moment looks like this?

    PHP Code:
    // Pull info from "links_info" into $links_info[]
    $database_info_links_info mysql_query"SELECT * from links_info WHERE cat = $cat);

    while ( 
    $links_info mysql_fetch_array($database_info_links_info) )
        {
        print(
    "<li><p><b><a href=http://eerie.net/links/external.php?id=$links_info[id]&cat=$links_cat[id]>$links_info[title]</a></b> - $links_info[comments]<br>
        <small>(<b>Added:</b> 
    $links_info[date], <b>Hits:</b> $links_info[hits])</small></p></li>");
        } 
    There will be another field in the database called points, and I'd like to order the listing with the sites with the most points at the top, how do I do this?

    Thanx
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SELECT***FROM*links_info*WHERE*cat*=*$cat ORDER BY points

    You can specify the order to be ascending or descending; ie,
    ORDER BY points ASC
    ORDER BY points DESC

    However, note that the default is to order ascending.

  3. #3
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you.

    that's what I like about this place, there is allways someone out there that can help with a problem, and fast :-)
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.


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
  •