当我输入有效的登录详细信息时,它不会重定向到welcome.php,但是如果我输入错误的登录详细信息,它会工作并重定向到error.html。我哪里错了?
$result = mysql_query($sql);
// Mysql_num_row is counting table row
$count = mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if ($count == 1){
session_start();
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$_SESSION['id'] = $id;
header("location:welcome.php");
} else {
header("location:error.html");
}
修改
在IF语句返回0之前 die($count);
并且:
var_dump(ini_get('error_reporting')); // string(5) "22519"
var_dump(ini_get('display_errors')); // string(0) ""
我想会话变量有问题......