I am creating a page to list select columns from each row in a table. I have the basics of that down by using a foreach loop as below and it works fine. The problem I am up against now is that I need to order the results by date (one of the columns) with the newest record being at the top.
This is what I have so far (that works but without sorting)
foreach ($visitors as $visitor) {
$id = htmlentities($visitor['family_id']);
$first_name = htmlentities($visitor['first_name']);
$last_name = htmlentities($visitor['last_name']);
$visit_date = htmlentities($visitor['visit_date']);
$phone = htmlentities($visitor['phone']);
$email = htmlentities($visitor['email']);
?>
<p><?php echo $visit_date; ?><a href="visitor-view.php?id=<?php echo $id; ?>"> <?php echo $first_name . ' ' . $last_name; ?></a> <?php echo $phone; echo $email; ?></p>
<?php
}
Hoping someone has a bright idea as to how to get it to sort.