Lately, I have been writing some code for my site. Usually, I have no bother with this bit of code, but it has suddenly started having issues. I am using mysqli_fetch_array to select some values from my database, but it is returning the error:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given.
I guess what we've all seen this error before, but I cannot seam to get rid of it. The code that it is referring to is as follows:
if (!empty($emailAddressGET) && !empty($passwordGET)) {
$infoGet = mysqli_query($dbConnect, "SELECT * FROM users WHERE emailAddress = '".$emailAddress."'");
while ($row = mysqli_fetch_array($infoGet, MYSQLI_ASSOC)) { //BUG LINE
//Code for setting cookies, checking values etc here
}
}
How can I prevent this error from happening?