select records from sql database order by date DESC, but I want show records in table in date ASC

Viewed 4225

I have 7 records in a table but I want select only last 5 records sorting by date DESC. And I want to show these records in my table sorting by date ASC.

My Code:

$select_record = mysqli_query($con, "select * from table order by date DESC limit 5");
while($row=mysqli_fetch_array($select_record)){

$date = $row['date'];

echo "<tr><td>$date<br></td></tr>";

Records in My Table like this

Date
2014-05-15
2014-04-15
2014-06-15
2014-02-15
2014-07-15
2014-01-15
2014-03-15

My code give me result like this

Date
2014-07-15
2014-06-15
2014-05-15
2014-04-15
2014-03-15

But I want result like this

Date
2014-03-15
2014-04-15
2014-05-15
2014-06-15
2014-07-15
6 Answers
Related