I have am grabbing a whole lot of data from a table in a mysql database and displaying it on a page. The code looks like this.
<?php
$sql = "SELECT * FROM $table_name";
$result = mysql_query($sql);
while($rows = mysql_fetch_array($result)){
?>
<tr class="contact-content">
<td><?php echo $rows['ID']; ?></td>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['email']; ?></td>
<td><?php echo $rows['tel_home']; ?></td>
<td><?php echo $rows['tel_mobile']; ?></td>
<td><?php echo $rows['tel_work']; ?></td>
</tr>
<?php
}
?>
It currently displays results like this
1 | James | [email protected] | 1234567 | 1234567 | 9876
2 | Anna | [email protected] | 8768765 | 6543 | 9876
But I would like to reverse it and display the results something like this ordered by there id
2 | Anna | [email protected] | 8768765 | 6543 | 9876
1 | James | [email protected] | 1234567 | 1234567 | 9876