Home >Backend Development >PHP Tutorial >Code sharing to test whether PHP connection to MySQL is successful_PHP tutorial

Code sharing to test whether PHP connection to MySQL is successful_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:40:251018browse

In many cases we don’t know whether it is a PHP error or an incorrect mysql username and password that causes cms operation errors. You can test it with the following code first

The method is simple: ​ Save the following code as test.php, put it in the web directory and execute it. ​ The code is as follows: ​ ​ The parameters of the mysql_connect() function are: mysql server name or IP, mysql user name, and mysql user password.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/727551.htmlTechArticleIn many cases we don’t know whether it is a php error or an incorrect mysql username and password that causes a cms operation error. You can use Just test the following code. The method is very simple: change the following...
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