mysqli_fetch_array() Error When Checking for Duplicate Data
When attempting to determine if a Facebook User_id exists in a database, users may encounter the error: "mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given."
Analysis
This error indicates that the mysqli_query() function, which executes the database query, is failing and returning false. As a result, mysqli_fetch_array() is unable to retrieve the expected result set from the query.
Solution
To troubleshoot the issue, insert the following code after the mysqli_query() call:
if (!$check1_res) { trigger_error(mysqli_error($con), E_USER_ERROR); }
This code displays the MySQL error message associated with the failed query, providing insights into the underlying cause of the problem.
Additional Information
For more detailed documentation on the mysqli_error() function:
The above is the detailed content of Why Does `mysqli_fetch_array()` Return \'expects parameter 1 to be mysqli_result, boolean given\' When Checking for Duplicate Data?. For more information, please follow other related articles on the PHP Chinese website!