'.GetEvents()"); function GetEvents() { $days = 30; if (isset($_POST['days'])) { $days = intval($_POST['days']); } $dsn = 'sqlite:////home/crux/public_html/local/timeline.db'; $db =& DB::connect($dsn); if (DB::isError($db)) die("Cannot connect to database"); $db->setFetchMode(DB_FETCHMODE_ASSOC); $from = time() - ($days * 24 * 60 * 60); $sql = "select * from events where event_tstamp >= $from order by event_tstamp desc"; $res =& $db->Query($sql); if (DB::isError($res)) die("Query error"); $timeline .= ''."\n"; $currdate = "noway"; while ($evt =& $res->fetchRow()) { if ($evt['event_date'] != $currdate) { $timeline .= '\n"; } $event_description = $evt['event_description']; if ($evt['event_notes'] != "") { $event_description .= ": ".$evt['event_notes']; } $img = ''; $timeline .= ''; $timeline .= "\n"; $currdate = $evt['event_date']; } $timeline .= "
'.$evt['event_date']."
'.$evt['event_time'].''.$img.''.$event_description.'
\n"; $timeline .= '
Show the latest days
'."\n"; return $timeline; } ?>