Home >Backend Development >PHP Problem >What should I do if php mysql_connect is not supported?

What should I do if php mysql_connect is not supported?

藏色散人
藏色散人Original
2020-09-04 09:22:413392browse

php mysql_connect is not supported because PHP7 no longer supports the "mysql_connect" function. This function is an obsolete function and needs to be replaced by MySQLi or PDO_MySQL extension.

What should I do if php mysql_connect is not supported?

Recommended: "PHP Video Tutorial"

mysql_connect() php7 does not support it, php5.5 does, yes Abandoned function

I have been using PHP7 for days and found that there are quite a lot of changes compared to PHP5. The biggest one is that the MySQL connection library has changed.

The mysql_connect() function is used in PHP5 to connect, but in fact, starting from PHP5.5, MySQL is no longer recommended and is an abandoned function.

It seems that it is no longer supported in PHP7. According to the official website, they are replaced by the following two:

This extension has been deprecated since PHP 5.5.0 and will be removed in the future. It should be replaced with the MySQLi or PDO_MySQL extension. See the MySQL: Choosing an API guide and related FAQ for more information. Alternatives to this function are:

mysqli_connect()

PDO::__construct()

When using, do not use mysql_connect, you can use mysqli_connect() instead , the usage is basically similar, it is said to be an object-oriented library.

In php.ini, there is only extension=php_mysqli.dll, and there is no longer extension=php_mysql.dll.

The above is the detailed content of What should I do if php mysql_connect is not supported?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn