致命错误:调用未定义的函数 mysql_connect() [英] Fatal error: Call to undefined function mysql_connect()
本文介绍了致命错误:调用未定义的函数 mysql_connect()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经设置了 PHP、MySQL 和 Apache.localhost()
用于 PHP,它运行良好.但是在我下载 MySQL 后,它报告:
I have set up PHP, MySQL, and Apache. localhost()
for PHP and it is working well. But after I downloaded MySQL, it reports:
致命错误:调用未定义的函数 mysql_connect()
Fatal error: Call to undefined function mysql_connect()
我该如何解决这个问题?
How can I fix this?
推荐答案
您升级到 PHP 7,现在 mysql_connect
已弃用.检查您的:
You upgraded to PHP 7, and now mysql_connect
is deprecated. Check yours with:
php -version
将其更改为 mysqli_connect
如下:
$host = "127.0.0.1";
$username = "root";
$pass = "foobar";
$con = mysqli_connect($host, $username, $pass, "your_database");
如果您要升级旧版 PHP,现在您将面临将所有 mysql_*
函数升级为 mysqli_*
函数的任务.
If you're upgrading legacy PHP, now you're faced with the task of upgrading all your mysql_*
functions with mysqli_*
functions.
这篇关于致命错误:调用未定义的函数 mysql_connect()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文