query($sql)) { if ($q->num_rows()) { while($q->next_record()) { $maxdate = $q->f('DateString'); } } } // use qstring, if it's there $thedate = null; $sql = "SELECT NewsID, Title, Body, Active, ImagePath, ImageBorder, ImageTitle, Date, DATE_FORMAT(Date, '%Y%m%d') as DateString"; $sql .= " FROM News WHERE Active = 1"; $sql .= " ORDER BY Date DESC"; if (isset($_GET['date'])) { $finddate = $_GET['date']; if ($q->query($sql)) { if ($q->num_rows()) { while($q->next_record()) { if ($q->f('DateString') == $finddate) $thedate = $q->f('DateString'); } } } } if (!isset($thedate)) { // they didn't pass one or we didn't find it $thedate = $maxdate; } // Now we have $thedate, loop if ($q->query($sql)) { if ($q->num_rows()) { while($q->next_record()) { if ($q->f('DateString') == $thedate) { // date $rawdate = $q->f('DateString'); $displayDate = date("j F Y", mktime(0,0,0, substr($rawdate,4,2), substr($rawdate,6,2), substr($rawdate,0,4))); // title? $title = stripslashes($q->f('Title')); // image? $image = null; if (!is_null($q->f('ImagePath'))) { $image = 'f('ImageTitle'))) { $image .= ' title="' . $q->f('ImageTitle') . '"'; } $image .= ' alt=""'; if (!is_null($q->f('ImageBorder'))) { $image .= ' border="' . $q->f('ImageBorder') . '"'; } $image .= ' />'; } // body $pattern = chr(13) . chr(10) . chr(13) . chr(10); $body = '

' . eregi_replace($pattern, "

\n

", stripslashes($q->f('Body'))) . '

'; ?>

0) /* && ($thedate == $maxdate)*/ ) echo "$image "; ?> 0) echo "

$title

\n"; ?>

seek(); } } // This is a list of links for previous content. if ($q->num_rows() > 1) { ?>
previous news:
next_record()) { $rawdate = $q->f('DateString'); $displayDate = date("j F Y", mktime(0,0,0, substr($rawdate,4,2), substr($rawdate,6,2), substr($rawdate,0,4))); // if ($q->f('DateString') < $thedate) { // or, you know, not equal to it... if ($q->f('DateString') != $thedate) { // or, you know, less than it... ?>
(shown)