OK Thank You. However it is still showing the entire schedule (past, present and future). I would like to see the future 45 days out and greater.
Here's the entire code:
<?
include("common.php");
$db_name = "$db";
$table_name = "$table";
$fortyfive_days = time() + (606024*45);
$classdate = date('Y-m-d', $fortyfive_days);
$connection = @mysql_connect("$server", "$user", "$password") or
die("Couldn't connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select
database.");
$sql = "
select id, coursecode, coursename, startdate, starttime, stopdate
from $table_name
WHERE startdate >= $classdate
order by startdate
";
$result = @($sql,$connection) or die("Couldn't execute query.");
$courses = "
<table width=700 cellpadding=3 cellspacing=3 border=0>
<tr>
<td bgcolor=#0ED8D6 width=100><font face=\"verdana\" size=\"2\">Course Code:</font></td>
<td bgcolor=#0ED8D6 width=300><font face=\"verdana\" size=\"2\">Course Name:</font></td>
<td bgcolor=#0ED8D6 width=100><font face=\"verdana\" size=\"2\">Start Date:</font></td>
<td bgcolor=#0ED8D6 width=100><font face=\"verdana\" size=\"2\">Start Time:</font></td>
<td bgcolor=#0ED8D6 width=100><font face=\"verdana\" size=\"2\">End Date:</font></td>
</tr>
";
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$coursecode = $row['coursecode'];
$coursename = $row['coursename'];
$startdate = $row['startdate'];
$starttime = $row['starttime'];
$stopdate = $row['stopdate'];
$courses .= "<tr>
<td bgcolor=#ECDC94 width=100><font face=\"verdana\" size=\"2\">$coursecode</font></td>
<td bgcolor=#ECDC94 width=300><font face=\"verdana\" size=\"2\">$coursename</font></td>
<td bgcolor=#ECDC94 width=100><font face=\"verdana\" size=\"2\">$startdate</font></td>
<td bgcolor=#ECDC94 width=100><font face=\"verdana\" size=\"2\">$starttime</font></td>
<td bgcolor=#ECDC94 width=100><font face=\"verdana\" size=\"2\">$stopdate</font></td>
</tr>";
}
$courses .= "</table>";
?>
Thanks for any help.
:o) Ivan
nate parsons wrote:
put your where clause before the order by clause.