<div class="main_block"> <br> <h2> Top questions on forum :</h2> <br><br> <div class="questions"> <table> <?php $records = Top_qstn_model::get_qstns(); $i = 1; foreach ($records as $d) { echo "<tr>"; echo "<td class=\"answers\"> <div class=\"division_no\">" . $d->replies . "</div><div class=\"division\">answers</div>\r\n\t\t\t\t<td class=\"views\"><div class=\"division_no_v\">" . $d->views . "</div><div class=\"division_v\">views</div>\r\n\t\t\t\t<td class=\"qstns\"><a href=\"" . base_url() . "index.php/guest/display_qstn/" . $d->q_id . "\">" . $d->title . "</a>\r\n\t\t\t\t<td class=\"users\"> asked by " . $d->nickname . "\r\n\t\t\t</tr>"; } ?> </table> </div> </a></div> <br><br> </div>
public function get_qstns() { $query = "select * from top_qstns;"; $records = $this->db->query($query); return Top_qstn_model::instantiate($records); }