The function below is what I used to display the contents of a table called ‘tw’. It is in reverse order. I need to change the order.
public static function posts()
{
$obj = new view;
$email = $_SESSION['email'];
$query_return = database::query("SELECT * FROM tw");
while ($a = mysql_fetch_assoc($query_return))
{
$date = date('M j \a\t g:i:s a', $a[time]);
echo "<div class=\"Bb2b\"><img class=\"a\" src=\"p/$a[email].jpg\" alt=\"\"/><a href=\"javascript:void(0)\">$a[fname] posted on $date</a><br/><p class=\"c\">$a[message]</p></div>";
}
}
In your query you could append
ORDER BY `time` ASCorORDER BY `time` DESCwhichever suits your needs (time is a dummy name, I don’t know your table structure) [time as being a column].EX:
SELECT * FROM `tw` ORDER BY `time` DESCMore info on SELECT