Home >php教程 >php手册 >Code to test the success of PHP connection to MYSQL_php basics

Code to test the success of PHP connection to MYSQL_php basics

PHP中文网
PHP中文网Original
2016-05-16 09:00:052905browse

code to test the success of php connection to mysql_php basics:

the method is very simple:

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

<?php 
$link=mysql_connect("localhost","root","123"); 
if(!$link) echo 
"FAILD!连接错误,用户名密码不对"; 
else echo "OK!可以连接"; 
?>

the parameters of the mysql_connect() function are: mysql server name or ip, mysql user name, and mysql user password.

the above is the code to test the success of php connection to mysql_php basic content. for more related content, please pay attention to the php chinese website (www.php.cn)!


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