I'm a beginner in PHP and MySQL.
I'm trying to create a basic site with users. Right now I'm creating the log in page, and I'm using the following two lines, where the mysqli_fetch_array()
is just to see if there are any with user as $_POST['user']
and pass as $_POST['pass']
:
$query = mysqli_query($con,"SELECT * FROM persons WHERE user='" . $_POST['user'] . "' AND pass=ENCODE('" . $_POST['pass'] . "',passcode)");
while(mysqli_fetch_array($query)) // line 65
// ..
When there is the error
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\xampp1.8.3\htdocs\hkmschat\default.php on line 65
Why is this statement boolean? I've used mysqli_fetch_array()
and very similar queries many times for other verifications in the same script, but none of them have returned something like this.
I know there are a lot of these out there, but I haven't found one yet that has answered this question yet. If you could please redirect me to a good answer or answer this question, that would be appreciated.
Thanks.