我有两个名为$ email和$ pass的php值。
email - MySQL数据库中的行名称 password - MYSQL数据库中的行名称
我正在运行一个SQL查询来从表成员中选择email = $ email和password = $ pass。
然后我运行mysqli_query以查看是否存在行,我没有得到任何结果。当然回声会回显出信息匹配的ID。
//Get the connection info.
global $connect;
$sql = "SELECT FROM members WHERE email='$email' AND password='pass'";
//Fetch the row and store the ID of this row.
$row = mysqli_query($connect, $sql);
$id = $row['userID'];
echo $id;
答案 0 :(得分:2)
除了这个代码大量暴露于SQL注入之外......你正在查询数据但没有获取结果。
添加fetch命令:
Identity