这是我的网站如何连接到 mysql 数据库,直到 php 升级到版本 5.4
public function core() {
if (!@$this->dbCon = mysql_connect($this->host, $this->user,$this->password)) {
exit('Error: Could not make a database connection using ' .
$this->user . '@' . $this->host);
}
但是现在,我得到错误:无法使用 user@host 建立数据库连接
。
如何使用 PDO 重写此代码?
最佳答案
mysql 函数已弃用。尝试使用 mysqli_connect 函数。
关于php - 错误 : Could not make a database connection using user@host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32319871/