我从表中选择mysql有问题。你可以帮我纠正一下,或者至少告诉我,我做错了吗?感谢
$row = *mysqli_query($con, "SELECT `user`, `pass` FROM `users` WHERE `user` = '$uname'");
if ( $row && ['password'] == $pass ) {
echo "Logged";
} else {
echo "Incorect user/password";
}
答案 0 :(得分:1)
对于成功的SELECT,SHOW,DESCRIBE或EXPLAIN查询mysqli_query
将返回一个mysqli_result对象。您需要调用mysqli_fetch_array
来从结果对象中获取行。
$res = mysqli_query($con, "SELECT `user`, `pass` FROM `users` WHERE `user` = '$uname'");
$row = mysqli_fetch_array($res);