Home > Database > Mysql Tutorial > body text

Why Does `mysqli_fetch_array()` Return \'expects parameter 1 to be mysqli_result, boolean given\' When Checking for Duplicate Data?

DDD
Release: 2024-11-25 18:58:11
Original
871 people have browsed it

Why Does `mysqli_fetch_array()` Return

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);
}
Copy after login

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:

  • [PHP Manual: mysqli_error()](http://www.php.net/manual/en/mysqli.error.php)

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template