• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search feature displays all data from database?

#1
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>
                </div>
         </div>
</form>


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);    
   $this->load->view('search',$data);      
   }
theromie
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.