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
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);
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
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.