php - CodeIgniter link to search -


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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -