// // "$Id: poll.php,v 1.1 2004/05/20 03:38:42 mike Exp $" // // Common poll interface functions... // // This file should be included using "include_once"... // // Contents: // // get_recent_poll() - Get the most recent poll... // show_poll() - Show a poll... // // // Include necessary headers... // include_once "db.php"; // // Constants for poll_type column... // $POLL_TYPE_PICKONE = 0; $POLL_TYPE_PICKMANY = 1; // // 'get_recent_poll()' - Get the most recent poll... // function // O - Poll ID or 0 get_recent_poll() { $result = db_query("SELECT id FROM poll WHERE is_published = 1 " ."ORDER BY id DESC LIMIT 1"); $row = db_next($result); $id = (int)$row['id']; db_free($result); return ($id); } // // 'show_poll()' - Show a poll... // function show_poll($id) // I - Poll ID { global $PHP_SELF, $POLL_TYPE_PICKONE, $POLL_TYPE_PICKMANY; $result = db_query("SELECT * FROM poll WHERE is_published = 1 AND id = $id"); if (db_count($result) == 1) { $row = db_next($result); $id = $row['id']; $question = htmlspecialchars($row['question']); print("
\n"); } db_free($result); } // // End of "$Id: poll.php,v 1.1 2004/05/20 03:38:42 mike Exp $". // ?>