严重程度:8192
消息:mysql_connect():不推荐使用mysql扩展,将来会删除它:使用mysqli或PDO代替
文件名:mysql / mysql_driver.php
行号:136
回溯:
文件:C:\ wamp \ www \ ci \ application \ controllers \ c_testing.php 行:27 功能:__construct
文件:C:\ wamp \ www \ ci \ index.php 行:315 功能:require_once
在databease.php的codeigniter文件中我用这个
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost:81',
'username' => 'root',
'password' => '1234',
'database' => 'testing',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
然后在我的testing.php文件中
Class Testingdata extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();
$this->db->reconnect();
}
// data obtained from database
function get_data(){
$this->db->select('*');
$this->db->from('lecturer_profile');
$query = $this->db->get();
return $query->result();
}
}
?>`enter code here`
答案 0 :(得分:0)
您需要更改数据库配置。转到项目/application/config/database.php
中的以下路径,找到dbdriver
设置并确保其为mysqli
。