以下是代码:
public function get_id_model($email){
$this->db->select('user_id');
$this->db->where('email', $email);
$query = $this->db->get('users');
return $query->result();
}
此代码在本地工作正常。但是当我将项目推送到000webhost时,它返回了null,尽管我的远程数据库包含数据。
database.php中
$db['remote']['hostname'] = 'xxx.000webhost.com';
$db['remote']['username'] = 'xxx';
$db['remote']['password'] = 'xxx';
$db['remote']['database'] = 'xxx';
$db['remote']['dbdriver'] = 'mysql';
$db['remote']['dbprefix'] = '';
$db['remote']['pconnect'] = TRUE;
$db['remote']['db_debug'] = TRUE;
$db['remote']['cache_on'] = FALSE;
$db['remote']['cachedir'] = '';
$db['remote']['char_set'] = 'utf8';
$db['remote']['dbcollat'] = 'utf8_general_ci';
$db['remote']['swap_pre'] = '';
$db['remote']['autoinit'] = TRUE;
$db['remote']['stricton'] = FALSE;
在Autoload.php中
$autoload['libraries'] = array('database', 'session');
我错过了什么吗?
答案 0 :(得分:-2)
只需将数据库驱动程序从mysql更改为mysqli即可。您可以在config文件夹中的database.php文件中执行此操作。