php - CodeIgniter link to search -
this question has answer here:
i'm new php , codeigniter , i'm trying create link in view that, when clicked return list of data specific category.
vgs_model.php model
public function pclist(){ $this->db->select('*'); $this->db->from('videogame'); $this->db->where('format', 'pc'); $query = $this->db->get(); return $query->result(); }
search.php controller
public function __construct() { parent::__construct(); $this->load->helper('form'); $this->load->helper('url'); $this->load->model('vgs_model'); } public function index() { $this->load->view('header_view'); $this->load->view('search_view'); $this->load->view('footer_view'); } public function getpc(){ $search_term = 'pc'; $data['results'] = $this->vgs_model->pclist(); $this->load->view('search_results', $data); }
search_view view
<a href = <?php echo site_url('hello/getpc'); ?>>view pc games</a>
i've been getting following error
message: undefined property: search::$vgs_model filename: controllers/search.php line number: 40
line 40 $data['results'] = $this->vgs_model->pclist();
what doing wrong? appreciated.
thanks reading post.
that sould in lowercase:
$data['results'] = $this->vgs_model->pclist();
Comments
Post a Comment