Inheritance: extends CI_Model
 public function search()
 {
     $data['message'] = "";
     $this->form_validation->set_rules('search_term', '"Search Term"', 'trim|required|max_length[60]|xxs_clean');
     if ($this->form_validation->run() == TRUE) {
         $search_term = $this->input->post('search_term');
         $data['search_term'] = $search_term;
         $qids = array();
         $qids = new Search_model();
         $qids->get_result($search_term);
     }
     $this->load->view('header/header_without', $data);
     $this->load->view('search_questions', $data);
     $this->load->view('sidebar/right_sidebar', $data);
     $this->load->view('footer/footer', $data);
 }
	<br>
		<h2> Search results:</h2>
		
	<br>
	<div class="questions">
	<div class="err_msg"><?php 
echo "<p>{$message}</p>";
?>
 <?php 
echo validation_errors();
?>
</div><br>
	<table>
		<?php 
if (!validation_errors()) {
    $records = Search_model::get_result($search_term);
    $i = 1;
    if ($records & $search_term != "") {
        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/User/display_qstn/" . $d->q_id . "\">" . $d->title . "</a>\r\n\t\t\t\t<td class=\"users\"> asked by " . $d->user . "\r\n\t\t\t</tr>";
        }
    } else {
        echo "No result found for \" " . $search_term . " \"";
    }
}
?>
		</table>
	</div>
		<br><br>
 public function all_terms()
 {
     $query = "select * from all_qstns;";
     $records = $this->db->query($query);
     return Search_model::instantiate($records);
 }