Home > php教程 > php手册 > body text

Code to test the success of PHP connection to MYSQL_php basics

PHP中文网
Release: 2016-05-16 09:00:05
Original
2853 people have browsed it

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!可以连接"; 
?>
Copy after login

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


Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template