Jump to content

changing order of mysql results


joemorris86

Recommended Posts

Hi, I'm currently using the code below to display the results from my database, and I was wondering if theres a way I can flip the results because at the moment the newest message entered (its a chat box) is displayed at the bottom, i would prefer it at the top.

<?php$host = "";$user = "";$pass = "";$db = "";$connection = mysql_connect($host,$user,$pass);if (!$connection)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("$db", $connection);$result = mysql_query("SELECT * FROM chat");while($row = mysql_fetch_array($result))  {  echo $row['name'];  echo ':';  echo $row['message'];  echo '<br />';  }mysql_close($connection);?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...