Home > Backend Development > PHP Tutorial > PHP5如何连接不上MySQL数据库

PHP5如何连接不上MySQL数据库

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:35:09
Original
860 people have browsed it

PHP5怎么连接不上MySQL数据库?
代码
$db_host='localhost';
$db_database='120422db_1';
$db_username='root';
$db_password='1234';

?>



include('120422php_1.php');

$connection = mysql_connect($db_host, $db_username, $db_password);
if(!$db_connection){
die ("Could not connect to the database:
". mysql_error());
}
?>


结果:Could not connect to the database:

------解决方案--------------------
if(!$db_connection){
用错了变量!
应该是 $connection

Related labels:
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
Latest Issues
Close PDO connection
From 1970-01-01 08:00:00
0
0
0
How to write the connection file?
From 1970-01-01 08:00:00
0
0
0
MongoDB closes connection - Stack Overflow
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template