我有两个名为$ email和$ pass的php值 .
email - MySQL数据库密码中的行名 - 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;
1 回答
除了这个代码大量暴露于SQL注入的事实之外......你正在查询数据但没有获取结果 .
添加fetch命令: