致命错误:调用未定义函数 mysql_connect() [英] Fatal error: Call to undefined function mysql_connect()

查看:59
本文介绍了致命错误:调用未定义函数 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,现在您面临的任务是使用 mysqli_* 函数升级所有 mysql_* 函数.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆