的index.php为什么位置部分不工作?
$password = hash('sha256', $pass); // password hashing using SHA256
$res=mysql_query("SELECT * FROM users WHERE userEmail='$email'");
$row=mysql_fetch_array($res);
$count = mysql_num_rows($res); // if uname/pass correct it returns must be 1 row
if($count == 1 && $row['userPass']==$password) {
$_SESSION['user'] = $row['userId'];
$_SESSION['location'] = $row['userLocation'];
header("Location: home.php");
} else {
$errMSG = "Incorrect Login";
}
Home.php
$query = "SELECT * FROM machines WHERE locatie=".$_SESSION['location'];
$result = mysql_query($query);
为什么这个不行? 我想不通为什么$_SESSION['locatie']
部分不起作用? 我认为它与其他文件具有相同的值。
您必须在标头 –
不使用mysql函数后停止进一步处理。使用mysqli或pdo – Akintunde007
所以代码将会是header(“Location:home.php”); die;试试这个 –