<div class="main_block"> <br> <h2> Recent questions on forum :</h2> <br><br> <div class="questions"> <table> <?php $records = Recent_qstn_model::find_all_qstn(); $i = 1; foreach ($records as $d) { echo "<tr>"; echo "<td class=\"answers\"> <div class=\"division_no\">" . $d->replies . "</div><div class=\"division\">answers</div>\n\t\t\t\t<td class=\"views\"><div class=\"division_no_v\">" . $d->views . "</div><div class=\"division_v\">views</div>\n\t\t\t\t<td class=\"qstns\"><a href=\"" . base_url() . "index.php/user/display_qstn/" . $d->id . "\">" . $d->title . "</a>\n\t\t\t\t<td class=\"users\"> asked by " . $d->user . "\n\t\t\t</tr>"; } ?> </table> </div> <br><br> </div> </div>
public function recent_questions() { $qstn = Recent_qstn_model::find_all_qstn(); $data['username'] = $this->session->userdata('username'); $data['nickname'] = $this->session->userdata('nickname'); $this->load->helper('url', $data, $qstn); $this->load->view('header/header_with', $data, $qstn); $this->load->view('recent_questions', $data, $qstn); $this->load->view('sidebar/right_sidebar', $data); $this->load->view('footer/footer', $data, $qstn); }
public function find_all_my_qstn() { $uid = $this->session->userdata('userid'); $records = $this->db->query("select * from recent_qstns where uid=\"" . $uid . "\" order by time desc ;"); return Recent_qstn_model::instantiate($records); }