【发布时间】:2017-04-19 06:13:52
【问题描述】:
我是 php 新手并尝试制作登录表单,但在建立连接时会出错。我没有得到它。
<?php
// this will avoid mysql_connect() deprecation error.
error_reporting( ~E_DEPRECATED & ~E_NOTICE );
// but I strongly suggest you to use PDO or MySQLi.
define('DBHOST', 'localhost');
define('DBUSER', 'root');
define('DBPASS', '');
define('DBNAME', 'simple_login');
$conn = mysqli_connect(DBHOST,DBUSER,DBPASS);
$dbcon = mysqli_select_db(DBNAME,$conn);
if ( !$conn ) {
die("Connection failed : " . mysqli_error());
}
if ( !$dbcon ) {
die("Database Connection failed : " . mysqli_error());
}
如果有人知道请帮助我。提前谢谢。
【问题讨论】:
-
在每行之后回显并在失败之后进行注释。
-
下面有两个人回答了。