php - Display the result of the search bar in codeigniter -


good day have trouble in codeigniter suppose display data (the first name , student id of student) in oracle database depending on type in search box. example the name of student search box when click submit button display data of student. try search code , use displayed error 404 page not found. here code

this view mysearch.php

<form action="<?php echo site_url('search/search_keyword');?>" method = "post">     <input type="text" name = "keyword" />     <input type="submit" value = "search" /> </form> 

this controller search.php

class search extends ci_controller {     function __construct()     {                 parent::__construct();          $this->load->database();         $this->load->model('mymodel');     }      function search_keyword()     {         $keyword = $this->input->post('keyword');         $data['results'] = $this->mymodel->search($keyword);          $this->load->view('result_view', $data);     } } 

this model mymodel.php

class mymodel extends ci_model {     function __construct()     {         parent::__construct();     }      function search($keyword)     {          $this->db->like('name',$keyword);         $query = $this->db->get('tablename');         return $query->result();     } }    

this view result_view.php

<table> <?php     foreach ($results $row) { ?> <tr>     <td><?php echo $row->first_name?></td>     <td><?php echo $row->student_id?></td> </tr> <?php    } ?> </table> 


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

Python Error - TypeError: input expected at most 1 arguments, got 3 -

dns - How To Use Custom Nameserver On Free Cloudflare? -