Home  >  Article  >  Backend Development  >  Code to test the success of PHP connection to MYSQL_PHP Tutorial

Code to test the success of PHP connection to MYSQL_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 14:59:07884browse

The method is very simple:

Save the following code as test.php, put it in the web directory and execute it.

Copy code The code is as follows:

$link=mysql_connect("localhost" ,"root","123");
if(!$link) echo "FAILD! Connection error, wrong username and password";
else echo "OK! Can connect";
?>


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/328167.htmlTechArticleThe method is very simple: Save the following code as test.php, put it in the web directory and execute it. Copy the code The code is as follows: ?php $link=mysql_connect("localhost","root","123"); if(!$lin...
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