How to display the results from your database in order

Ascending
"SELECT * from name_of_table order BY date ASC"

Descending
"SELECT * from name_of_table order BY date DESC"

Retrieve Data From a MySQL Database

Using PHP you can run a MySQL SELECT query to fetch the data out of the database.

Here is an example of one of the easiest ways to fetch data, this example uses a table called contact which has four columns, name, subject, address and message

<?php include 'config.php';?>
<?php
$query = "SELECT name, subject, address, message FROM contact";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{echo "Name :$row['name']} <br>
Subject : {$row['subject']} <br>
Address: {$row['address']} <br>
Message : {$row['message']} <br>";
} ?>