CodeIgniter Forums

Full Version: Search feature displays all data from database?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is my index.php view file
<form class="form-inline" role="form" id="SJob" action="<?=site_url('search');?>">
        <div class="col-md-6 col-md-offset-3 input-group">
                <input type="text" id="searchjob" name="JSearch" class="input-job form-control"  required="required">
                <div class="input-group-btn">
                        <button class="btn btn-green" type="submit"><i class="fa fa-search"></i></button>

This is my model.php
public function get_SearchJobs($match){
            $data = array();
            $match = $this->input->post('JSearch');
            $this->db->like('JTitle', $match);
            $this->db->or_like('Skills', $match);
            $this->db->or_like('JLocation', $match);
            $query = $this->db->get('jobs');           
            if($query->num_rows() > 0)
                foreach ($query->result() as $row) {
                    $data[] = $row;
            return $data;        

This is my controller
public function search(){        
       $data = array();
       $match = $this->input->get('match');                
   $data['result'] = $this->mymodel->get_SearchJobs($match);