PHP Test example to determine whether the database is connected successfully, PHP judgment database example
Test example for PHP to determine if the database is connected successfully
If there is an incorrect database configuration, see the PHP and MySQL configuration tutorial:
How to configure the Php-apache-mysql environment under the Win7 system http://www.cnblogs.com/myall/p/4744837.html
Phperror_reporting(~E_all); $host=$_post[' Host ']; $user=$_post[' User ']; $pwd=$_post[' pwd ']; if(isset($_post[' Host ']) &&isset($_post[' User ']) &&isset($_post[' pwd '])){ if(strlen($host) <1 orstrlen($user) <1 orstrlen($pwd) <1){ Echo"Please complete the relevant database link information. "; Exit(0); } $conn=mysql_connect($host,$user,$pwd) or die("error-Database connection failed! "); if($conn){ Echo"Ok-database connection was successful! "; } }?>
http://www.bkjia.com/PHPjc/1053810.html www.bkjia.com true http://www.bkjia.com/PHPjc/1053810.html techarticle PHP to determine whether the database is connected to a successful test example, PHP Judge database example PHP to determine whether the database connection success Test example if the database configuration is incorrect error, please ...