Codeigniter HTML列表helper打破DB类


Codeigniter HTML list helper breaks the DB class

模型方法

public function my_friends_list($myId)
{
    $query = $this->db->query("CALL myFriendsList($myId)");
    return $query->result_array();
}
控制器

public function index()
{
    $data['friends'] = $this->friends_model->my_friends_list(1);
    $this->load->view('friends/index', $data);
}
<<p> 视图/strong>
<?php
    $list = $friends;
    echo(ul($list));
?>

如果我使用上面的一切工作。但是如果我把视图改成这样:

<?php
    //$list = $friends;
    echo(ul($friends));
?>

我得到以下错误信息

无法选择指定的数据库:My_Database_Name

文件名:C: ' xampp '数据库根' system ' ' DB_driver.php

我知道我可以简单地使用有效的视图,但我想了解发生了什么。它们不是等价的吗?

编辑:在我回到原来的视图后,清除错误的唯一方法是重新启动MySQL模块。

您正在调用存储过程,因此只需转到您的"config/database.php"并使用下面的代码进行更改。

$db['default']['dbdriver'] = 'mysql';
to 
$db['default']['dbdriver'] = 'mysqli';
and pconnect should be true
$db['default']['pconnect'] = TRUE;