-2
我在這裏有一些問題,從數據庫中檢索信息。什麼來檢索試圖登錄的用戶的id,但$ id變量似乎是空白的,而其他兩個返回正確的值和想法。SQL查詢中的空白字段
// check if the user id and password combination exist in database
$q = "SELECT * FROM users WHERE email='".$user."' AND password='".$pass."'";
// Run Query
$result = $li->query($q) or die(mysqli_error($mysqli));
// Numbers of rows that match
$num_rows = $result->num_rows;
echo $num_rows;
// Check if active status
$active = $result->fetch_object()->active;
echo $active;
$id = $result->fetch_object()->id;
echo $id;
密碼是純文本還是散列值? –