Getting an entry from SQL past a date
Posted: Thu Dec 14, 2006 9:19 pm
I wrote a homework system to keep track of my homework, but the problem is, when I enter something due in 2007 (just as a test) it doesn't show up, because I made it not show homework that has been due. Any ideas? Here's the sql code that I use to grab homework.
and to open it I use this
Any idea to why assignments in '07 don't show?
Code: Select all
function view_due($uid, $year, $month, $day) { // same as view but only views assignments that haven't been due already
echo "<a href='hw.php?type=all'>view all homework, even those already due</a><br>";
$sql = mysql_query("SELECT * from homework where uid = '$uid' AND due_y >= $year AND due_m >= $month AND due_d >= $day ORDER by due_d ASC") or die(mysql_error());
while($a = mysql_fetch_array($sql)) {
echo "<div style='border-bottom:2px solid #444'><b>{$a['title']}</b> for <u>{$a['class']}</u> due on {$a['due_m']}/{$a['due_d']}/{$a['due_y']}<br><font color='#eeeeee'>Added: {$a['as_m']}/{$a['as_d']}/{$a['as_y']}</font></div>";
echo "<blockquote>Description:<br><i>{$a['desc']}</i><br> <a href='delete.php?id={$a['id']}'>delete this</a></blockquote>";
}
}Code: Select all
<?php
$month = date('n');
$day = date('j');
$year = date('y');
$hw->view_due($_SESSION['uid'], $year, $month, $day);
?>