mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

Today, We want to share with you mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in.In this post we will show you mysqli fetch array expects parameter 1 to be mysqli result, hear for mysqli_fetch_assoc() expects parameter 1 to be mysqli_result boolean given in php we will give you demo and example for implement.In this post, we will learn about PHP Connect to MySQLi with an example.

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in…

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ,boolean given in c:\xampp

Read Also:  Laravel JSON Array Merge into one array

solve: 1

$result = mysqli_query($this->conn, $this->sql);
if (!$result) {
    printf("Error: %s\n", mysqli_error($this->conn));
    //exit();


Reference article: PHP MySQLi Database Connection

Solution : 2

That sql query is failing and returning false boolean value.

so you can simply use Put this after mysqli_query() to see what’s going on.

It means that the first parameter that is passed to mysqli_fetch_array is not of type mysqli_result.

    $user_sql_query = "SELECT * FROM `members` WHERE `google_id` = " . $google_id . " LIMIT 0, 50 ";
    $row_messages = mysqli_query($link, $user_sql_query);

if (!$row_messages) {
    printf("Error: %s\n", mysqli_error($link));
    exit();
}

$row_messages = mysqli_query($user_sql_query,MYSQLI_ASSOC);

Read Also:  C#.Net Enum(Enumeration) Tutorial with Examples

ERROR: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given

You can print the error

    $user_sql_query = "SELECT * FROM `members` WHERE `google_id` = " . $google_id . " LIMIT 0, 50 ";
    $row_messages = mysql_query($link, $user_sql_query);
if (!$row_messages) {
    die('Invalid query: ' . mysql_error());
}

Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, bool given in C:\xammp\htdocs\demo\index.php on line 11

where you are running mysqli_query , add ‘or die( mysqli_error($conn)’

#Example
$query = "SELECT * FROM products";
$result = mysqli_query($db, $query) or die( mysqli_error($conn));
#$conn being the variable holding the connection to conn

For more information: http://www.php.net/manual/en/mysqli.error.php

Read Also:  how to create database in mongodb?

I hope you get an idea about mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Check Uncheck All Checkboxes using jQuery Selectors
  2. Read Also:  PHP Toggle Like Dislike Rating System using jQuery Ajax
  3. Read Also:  Add Session Array programming with php
  4. Read Also:  Laravel 6 Excluding Routes From the CSRF Middleware
  5. Read Also:  jQuery Routing using Single Page Application without framework
  6. Read Also:  Angularjs convert json string to array
  7. Read Also:  Laravel 5.5 - Get Last Inserted ID With Example
  8. Read Also:  Laravel JSON Array Merge into one array
  9. Read Also:  Laravel 6 Excluding Routes From the CSRF Middleware
  10. Read Also:  jQuery Routing using Single Page Application without framework
CLOSEX