www.webdeveloper.com
Results 1 to 2 of 2

Thread: help with ordering from bottom up

  1. #1
    Join Date
    May 2006
    Posts
    46

    help with ordering from bottom up

    Code:
    <?
    
    include("--.php");
    
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die("Error : unable to connect to database!");
    
    $query="SELECT * FROM datatable";
    $result=mysql_query($query);
    
    $rows=mysql_numrows($result);
    
    mysql_close();
    
    echo "<b>Output</b><br><br>";
    
    $i=0;
    while ($i < $rows) {
    
    $id=mysql_result($result,$i,"id");
    $title=mysql_result($result,$i,"title");
    $notes=mysql_result($result,$i,"notes");
    
    echo "ID : $id<br>Title : $title<br>Notes : $notes<br><br>";
    
    $i++;
    }
    
    ?>
    I am having problems in trying or order it from bottom up.
    Can someone give me a clue?

  2. #2
    Join Date
    Jul 2005
    Location
    Washington, USA
    Posts
    34
    Try this:

    Code:
    $query="SELECT * FROM datatable ORDER BY COLUMN NAME DESC";
    where "COLUMN NAME" is the name of the column you want to sort by

    DESC = Descending
    ASC = Ascending

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles