-1

私は PHP と CodeIgniter がまったく初めてで、クリックすると特定のカテゴリのデータのリストが返されるリンクをビューに作成しようとしています。

vgs_model.php モデル

public function pcList(){

    $this->db->select('*');
    $this->db->from('videogame');
    $this->db->where('Format', 'PC');
    $query = $this->db->get();

    return $query->result();

}

search.php コントローラー

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 ビュー

<a href = <?php echo site_url('Hello/getPc'); ?>>View PC Games</a>

次のエラーが表示されます

Message: Undefined property: Search::$Vgs_model

Filename: controllers/search.php

Line Number: 40

40号線はこちら $data['results'] = $this->Vgs_model->pcList();

私は何を間違っていますか?どんな助けでも大歓迎です。

私の投稿を読んでくれてありがとう。

4

1 に答える 1