Codeigniter - calling the undefined method CI_DB_mysql_driver ::

I get this error "Fatal error: calling undefined method CI_DB_mysql_driver :: findVenueInfo ()" when I try to use one of my models.

I have a view with this anchor:

echo anchor('welcome/searchVenue/' . $row->venue_id, $row->venue);

which generates the link: http: //localhost/ci-llmg/index.php/welcome/searchVenue/1

the method is called

function searchVenue()
{
    $this->load->model('venues');
    //get venue info
    $data['info'] = $this->venues->findVenueInfo($this->uri->segment(3)); //this line generates the error

}

and findVenueInfo function in model (venues.php):

function findVenueInfo($id)
{
    $data = array();
    $this->db->where('id', $id);

    $Q = $this->db->get('venues');
    if ($Q->num_rows() > 0)
    {
        foreach ($Q->result() as $row)
        {
            $data[] = $row;
        }
    }

    $Q->free_result();
    return $data;
}

.. but the result is a fatal error: calling the undefined method CI_DB_mysql_driver :: findVenueInfo () I probably missed something stupid, but I can’t get it to work! What do you think?

+3
source share
3 answers

, index.php ur

index.php codeigniter.php.

index.php .

/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *

 * And away we go...
 *
 */

require_once APPPATH.'third_party/datamapper/bootstrap.php';

require_once BASEPATH.'core/CodeIgniter.php';
+5
function findVenueInfo($id)
{
    $data = array();
    $this->db->select()->from('venues')->where('id', $id);<----change it to

    $Q = $this->db->get();<----change it to
    if ($Q->num_rows() > 0)
    {
        foreach ($Q->result() as $row)
        {
            $data[] = $row;
        }
    }

    $Q->free_result();
    return $data;
}
+3

, 3.0 query_builder application/config/database.php

$query_builder = TRUE;
+2

Source: https://habr.com/ru/post/1739603/


All Articles