I have read the Next and Prev link tutorials here, having some trouble incorporating into my code.
Here's the deal. I have a mysql db with 2 years of data. I want to query the db and return one week (Sun - Sat) at a time, then have PREVIOUS and NEXT links to move to the appropriate week...struggling how to incorporate this into my existing code (see below)!!!!
Appreciate any guidance or feedback!!!
<title>weekly log</title>
<?php
$dbcnx = @mysql_connect("localhost","","");
if (!@mysql_select_db("database") ) {
echo( "<p>Unable to locate the ndorfnz dbat this time.</p>");
exit();
}
?>
<TABLE CELLSPACING=2 CELLPADDING=2 WIDTH="100%">
<TR>
<TD BGCOLOR="#808080" ALIGN=CENTER><FONT FACE="helvetica, arial"><B>DATE</B></FONT>
</TD>
<TD BGCOLOR="#808080" ALIGN=CENTER><FONT FACE="helvetica, arial"><B>ACTIVITY</B></FONT>
</TD>
<TD BGCOLOR="#808080" ALIGN=CENTER COLSPAN=2><FONT FACE="helvetica, arial"><B>STATISTICS</B></FONT>
</TD>
<?php
$query = "SELECT *, DATE_FORMAT(rundate, '%W, %M %d') as fdate from log";
$mysql_result = mysql_query($query);
$num_rows = mysql_num_rows($mysql_result);
$result = mysql_query($query);
for ($i=0; $i<8; $i++)
{
$row = mysql_fetch_array($result);
echo ("<tr>");
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>");
echo ("<TD BGCOLOR=#999999 ALIGN=CENTER VALIGN=TOP><FONT FACE=trebuchet, verdana, arial, helvetica, sans-serif SIZE=2>");
echo ($row[workout_type]);
echo ("<BR>");
echo ($row[starttime]);
echo ("</td>");
echo ("<TD BGCOLOR=#999999 ALIGN=CENTER VALIGN=TOP><FONT FACE=trebuchet, verdana, arial, helvetica, sans-serif SIZE=2>");
echo ($row[distance]);
echo (" miles");
echo ("<br>");
echo ("(");
echo ($row[course]);
echo (")");
echo ("<br>");
echo ("<br>");
echo ($row[runtime]);
echo ("<br>");
echo ("(");
echo ($row[runpace]);
echo (" min/mile)");
echo ("</td>");
echo ("<TD BGCOLOR=#999999 ALIGN=CENTER VALIGN=TOP><FONT FACE=trebuchet, verdana, arial, helvetica, sans-serif SIZE=2>");
echo ("Shoes: ");
echo ($row[shoes]);
echo ("<br>");
echo ("Weight: ");
echo ("</td>");
echo ("<tr>");
echo ("<TD COLSPAN=3 ALIGN=CENTER VALIGN=TOP BGCOLOR=#999999><FONT FACE=trebuchet, verdana, arial, helvetica, sans-serif SIZE=2>");
echo ($row[comments]);
echo ("</td>");
echo ("</tr>");
echo ("</tr>");
}
?>
</table>