rendered paste bodyprivate function my_polls() { $polls = $this->db->prepare("SELECT poll_title, poll_id FROM polls WHERE user = :user_id ORDER BY poll_id"); $polls->bindParam(":user_id", $this->user); $polls->execute(); $poll_wall_items = ""; $count = 0; while($row = $polls->fetch()) { $answers = ""; $this->template->assign("poll_title", $row->poll_title); $poll_answers = $this->db->prepare("SELECT poll_option FROM poll_answers WHERE poll_id = :poll_id"); $poll_answers->bindParam(":poll_id", $row->poll_id); $poll_answers->execute(); while($arow = $poll_answers->fetch()) { $answers .= "<tr><td> $arow->poll_option </td></tr>"; } $this->template->assign("poll_options", $answers); $count ++; $poll_wall_items .= $this->template->fetch("api_templates/poll_wall_item.php"); } if($count > 0) { $this->template->assign("poll_wall_items", $poll_wall_items); return $this->template->fetch("api_templates/poll_wall.php"); } return $this->template->fetch("api_templates/empty_pollbox.php"); }