|
初学CI,model连接数据库就出错。。。
- Severity: Error
- Message: Call to undefined function mysqli_init()
- Filename: mysqli/mysqli_driver.php
- Line Number: 126
复制代码
- $db['default'] = array(
- 'dsn' => '',
- 'hostname' => 'localhost',
- 'username' => 'root',
- 'password' => 'master',
- 'database' => 'phpwork',
- 'dbdriver' => 'mysqli',
复制代码
- class UserModel extends CI_Model {
-
- public function __construct() {
- parent::__construct ();
- $this->load->database ();
- }
-
- var $name = '';
- var $password = '';
-
- function get_last_ten_entries() {
- $query = $this->db->query ( 'SELECT * FROM t_user' );
- return $query->result ();
- }
- }
复制代码
driver换成mysql,错误就变成
- Severity: 8192
- Message: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
- Filename: mysql/mysql_driver.php
- Line Number: 136
复制代码
那应该怎么连?。。。 |
|