Results 1 to 2 of 2

Thread: array + mysql question

  1. #1

    Thread Starter
    Addicted Member Tommy101's Avatar
    Join Date
    Jun 2004
    Location
    Switzerland
    Posts
    144

    array + mysql question

    I have made a script that gets information from a mysql table and shows it in a html table. However i would like to have the html show the information from the bottom up. (because when i add a row in my mysql table it ends up at the bottom).

    Is there any way one could use the SORT_DESC function?

    My code looks like this at the moment:
    PHP Code:
    while ($line mysql_fetch_array($resultMYSQL_ASSOC)) {
       echo 
    "\t<tr>\n";
       foreach (
    $line as $col_value) {
           echo 
    "\t\t<td>$col_value</td>\n";
       } 


    Msn Messenger is the Best

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: array + mysql question

    If you have an ID field in your table you could sort by that so the newest records are always at the top. HTH


    PHP Code:
    $SQL "SELECT * FROM YourTable ORDER BY ID DESC"

Posting Permissions

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



Click Here to Expand Forum to Full Width