function getPolls() { global $db, $login; $polls = $db->selectList('detailedpoll', '*', '1', '`state` ASC, `date` DESC'); $num = count($polls); for ($i = 0; $i < $num; $i++) { $polls[$i]['url'] = makeUrl('detailedpoll', array('pollid' => $polls[$i]['detailedpollid'])); if ($polls[$i]['state'] == 0) { $polls[$i]['url_edit'] = makeUrl('detailedpoll', array('mode' => 'create', 'pollid' => $polls[$i]['detailedpollid'])); } $polls[$i]['url_delete'] = makeUrl('detailedpoll', array('mode' => 'delete', 'pollid' => $polls[$i]['detailedpollid'])); $polls[$i]['answerCount'] = countAnswers($polls[$i]['detailedpollid']); $polls[$i]['hasVoted'] = hasVoted($polls[$i]['detailedpollid'], $login->currentUserId()); } return $polls; }
<?php foreach ($questions as $question) { ?> <div id="div4"> <div id="idx_vote"> <div> <?php echo $question['Vote']; ?> </div> <div> Votes </div> </div> <div id="idx_answer"> <div> <?php $count = countAnswers($question['Q_ID']); ?> <?php echo $count; ?> </div> <div> Answer </div> </div> <div id="idx_title"> <a id="a3" href="question.php?q_id=<?php echo $question['Q_ID']; ?> "> <?php echo $question['Title'];
at <?php echo $question['Date']; ?> </span> | <span id="idx_edit"> <a id="a2" href="ask.php?q_id=<?php echo $question['Q_ID']; ?> "> edit </a> </span> | <span id="idx_delete"><a id="a4" href="javascript:confirmDelete(<?php echo $question['Q_ID']; ?> )" target="_parent" class="creator_delete"> delete </a> </span> </p> </div> <div id="AnswerCount"> <?php $count = countAnswers($_GET['q_id']); ?> <?php echo $count; ?> Answer<?php if ($count > 1) { echo 's'; } ?> </div> </div> </div> <div id="div3">