<?php
require_once("connect.php");
$login1 = $_POST['email'];
$password1 = $_POST['password'];
$select = "SELECT id FROM loginregistration WHERE login ='$login1', password ='$password1'";
$sql = mysqli_query($con,$select);
$row = mysqli_fetch_assoc($sql);
?>`
似乎我的mysqli_query不起作用,我该怎么办?
答案 0 :(得分:2)
在查询附近密码中使用AND insted逗号(,),这就是为什么查询返回false并抛出该错误
$select = "SELECT id FROM loginregistration WHERE login ='".$login1."' and password ='".$password1."'";
更新1
如果查询失败,则返回false。所以你可以使用mysqli_error($ con);知道错误
<?php
require_once("connect.php");
$login1 = $_POST['email'];
$password1 = $_POST['password'];
$select = "SELECT id FROM loginregistration WHERE login ='".$login1."' AND password ='".$password1."'";
$sql = mysqli_query($con,$select);
if($sql === FALSE) {
die(mysqli_error($con)); // better error handling
}
$row = mysqli_fetch_assoc($sql);
?>