UP Computer Science Interns' Blog

May 28, 2010


Filed under: dcs_200719929 — shippou @ 5:42 pm

I made this code myself.

Note: polls table contains pid, topic, question, uid and isActive fields.

//retrieve all results
$results = $db->query("SELECT * FROM polls");

if ($db->error!=""){
echo "There was an error retrieving the polls. Please try again.";

//print all the surveys
//note: only active polls must be listed.
while ($rows = $results->fetch_assoc()) {
$pid = $rows['pid'];
$topic = $rows['topic'];
$question = $rows['question'];
$poster = $rows['uid'];
$isActive = $rows['isActive'];

//override css for these links
if ($isActive==1) {
echo "<tr>
<td><a href=’print_survey.php?pid={$rows[‘pid’]}’ style=’color:blue; text-decoration: underline’>{$topic}</a></td>




Create a free website or blog at WordPress.com.

%d bloggers like this: