【发布时间】:2019-03-16 16:38:32
【问题描述】:
我收到这个错误
H01215:PHP 警告:mysqli_select_db() 期望参数 1 为 mysqli 字符串在
当我尝试从 MYSQL 更改为 MYSQLI 时,从我的网站上,为什么我错过了这个。我将每个mysql_ 更改为mysqli_
// Do we have a valid database connection and have we selected a database?
public function databaseSelected()
{
if(!$this->isConnected()) return false;
$result = mysql_list_tables($this->name, $this->db);
return is_resource($result);
}
public function connect()
{
$this->db = @mysql_connect($this->host, $this->username, $this->password) or $this->notify('Failed connecting to the database with the supplied connection details. Please check the details are correct and your MySQL user has permissions to access this database.<br/><br/>(host: '.$this->host.', user: '.$this->username.', pass: ********)');
if($this->db === false) return false;
mysql_select_db($this->name, $this->db) or $this->notify(); if($this->isConnected())
{
mysql_set_charset('UTF-8', $this->db);
$this->query("SET NAMES utf8");
}
return $this->isConnected();
}
【问题讨论】: