-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;
密码是纯文本还是散列值? –