I am querying records from a mysql db. I want to make a check against a date field and echo the results depending on if a new date is processed or if the previous date is again in the records.
Simple as below:
January 20, 2002 5 miles
6 miles
January 21, 2002 8 miles
10 miles
January 22, 2002 12 miles
January 23, 2002 13 miles
Below is how I am "attempting this"! Appreciate the feedback!!!!
<?php
$query = "SELECT *, DATE_FORMAT(rundate, '%W, %M %d') as fdate from log";
$result = mysql_query($query);
for ($i=0; $i<8; $i++)
{
$row = mysql_fetch_array($result);
echo ("<tr>");
if ($fdate ! $fdate)
{
//DATE OF RUN TD AND VALUE
echo ("<TD BGCOLOR=#999999 ALIGN=CENTER VALIGN=TOP ROWSPAN=2><FONT FACE=trebuchet, verdana, arial, helvetica, sans-serif SIZE=2>");
echo ($row[fdate]);
echo ("</TD>");
}
else
{
echo ("<TD BGCOLOR=#999999 ALIGN=CENTER VALIGN=TOP><FONT FACE=trebuchet, verdana, arial, helvetica, sans-serif SIZE=2>");
echo ($row[workout_type]);
}