My results are being displayed on a web page as a list in descending order by date. Today’s results at the top, then yesterdays below that and so on. Today may have 2 results so far; yesterday had 5 the day before that had 4 and so on.
Now I want the day of the week to be displayed for each day to divide the list on the page.
result
result
result
day of the week
result
result
result
result
result
day of the week
result
result
result
result
Can someone show me how to do this? Thanks.
Here is code that displays results in descending order.
<?php
$query = "SELECT name, id FROM table ORDER BY date DESC LIMIT 60";
$result = $db->query( $query );
while ($row = $result->fetch_assoc()) {
?>
<p><a href="display_results.php?id=<?php echo $row['id']; ?>"><?php echo $row['name']; ?></a></p>
<?php } ?>
That looks brilliantly simple. I was expecting a lot more involved coding.
When you say my column being a proper date type, I think your referring to the date column in my table.
My table has this for the date. date char(100) DEFAULT NULL,
This probably is not proper.
I will have to read through my PHP books to learn about date types, something I did not know about until now. After that I will try to test your example.