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
を使用すると、コードはヘッダ( "Location:home.php"); die;これを試してください –