Cannot use object of type mysqli_result as array
Use mysqli_fetch_assoc
or mysqli_fetch_array
to fetch a result row as an associative array.
$query = "SELECT 1"; $result = $mysqli->query($query); $followingdata = $result->fetch_assoc()
or
$followingdata = $result->fetch_array(MYSQLI_ASSOC);
Related Posts:
- Difference between “as $key => $value” and “as $value” in PHP foreach
- Array to String PHP?
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
- Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in
- mysqli_real_connect(): (HY000/2002): No such file or directory
- Convert a PHP object to an associative array
- How to echo or print an array in PHP?
- Fatal error: Call to undefined function mysqli_connect()
- mysqli_real_connect(): (HY000/2002): No such file or directory
- Fatal error: Call to undefined function mysqli_connect()
- Deleting an element from an array in PHP
- How to insert an item at the beginning of an array in PHP?
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- what is a good method to sanitize the whole $_POST array in php?
- Sort array of objects by object fields
- MySqli Commands out of sync; you can’t run this command now
- Commands out of sync; you can’t run this command now
- Call to undefined method mysqli_stmt::get_result
- Call to undefined method mysqli_stmt::get_result
- In_array not working
- PHP multidimensional array search by value
- How to solve “Fatal error: Class ‘MySQLi’ not found”?
- mysql_field_name to the new mysqli
- mysqli_select_db() expects parameter 1 to be mysqli, string given
- mysqli::query(): Couldn’t fetch mysqli
- php foreach with multidimensional array
- Convert php array to Javascript
- phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user ‘pma’@’localhost’ (using password: NO)
- Warning: mysqli_query() expects at least 2 parameters, 1 given. What? [duplicate]
- PHP reindex array?
- php – How do I fix this illegal offset type error
- Mysql where id is in array
- How to convert array to SimpleXML
- Deprecated: mysql_query() [duplicate]
- Object of class mysqli_result could not be converted to string
- Array of PHP Objects
- Is there a function to make a copy of a PHP array to another?
- How to Sort a Multi-dimensional Array by Value
- PHP array printing using a loop
- Fastest way to implode an associative array with keys
- Fatal error: Call to a member function fetch_assoc() on a non-object
- PHP array delete by value (not key)
- Having a problem getting mysqli_query to execute
- CodeIgniter: Unable to connect to your database server using the provided settings Error Message
- Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given… what I do wrong?
- PHP Multiple Checkbox Array
- Display array values in PHP
- Reset PHP Array Index
- How to push both value and key into PHP array
- Call to a member function fetch_assoc() on boolean in
[duplicate] - Remove empty array elements
- PHP variables don’t evaluate in the query [duplicate]
- Replace ' and similar html codes with their correspondent character?
- Google Calendar API event update always return 404 “not found” error
- How to prevent the “Confirm Form Resubmission” dialog?
- navigate back with PHP form submission
- How to set 777 permission on a particular folder? [closed]
- How do I make a redirect in PHP?
- How to use mysqli_query() in PHP?
- List of All Locales and Their Short Codes?
- How do I get a YouTube video thumbnail from the YouTube API?
- What is a slug?
- Visual list of all installed fonts with respective pangram phrase?
- How to add elements to an empty array in PHP?
- How to avoid Request Entity Too Large 413 error
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- count() parameter must be an array or an object that implements countable in laravel
- regex match any whitespace
- What’s the net::ERR_HTTP2_PROTOCOL_ERROR about?
- How to fix “Headers already sent” error in PHP
- currently unable to handle this request HTTP ERROR 500
- PHP page redirect
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- Whoops, looks like something went wrong. Laravel 5.0
- PHP “or” Syntax
- Fatal error: Call to undefined function mysql_connect()
- How to fix “Headers already sent” error in PHP
- Loop through an array php
- What are namespaces?
- Get the full URL in PHP
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- http://localhost:80 is not working on running Apache server through UniServer ZeroXIII
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- Mysql query- How to use contains?
- Form submission: PHP S_SESSION statements within a foreach loop
- How do I get PHP errors to display?
- S_SESSION variable (user role) not recognised
- What are the main differences between PHPExcel and PhpSpreadsheet?
- Is SAJAX dead? What to replace with?
- How do I resolve a HTTP 414 “Request URI too long” error?
- Get the full URL in PHP
- How do I check if a string contains a specific word?
- PDOException: SQLSTATE[HY000] [2002] No such file or directory
- xajax expanding list query
- How to force file download with PHP
- How do I get a file extension in PHP?
- How to Set Category Page as Home Page in Prestashop
- Get the full URL in PHP