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]
- Visual list of all installed fonts with respective pangram phrase?
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” using PHP
- Fatal error: Call to undefined function mysql_connect()
- Mysql query- How to use contains?
- what does PHP die() return
- Invalid column count in CSV input on line 1 Error
- how to replace quotation marks with \”
- mcrypt is deprecated, what is the alternative?
- why use 0xffff over 65535
- .rar, .zip files MIME Type
- PDO bindParam() with prepared statement isn’t working
- HTML Element Array, name=”something[]” or name=”something”?
- Why use $_SERVER[‘PHP_SELF’] instead of “”
- Setting up a PHP interpreter in PhpStorm
- PHP: $_SERVER variables: $_SERVER[‘HTTP_HOST’] vs $_SERVER[‘SERVER_NAME’]
- Illegal string offset Warning PHP
- Could not open input file: artisan
- PHP: variables in strings without concatenation
- PHP mail not working for some reason
- Get Root Directory Path of a PHP project
- Returning JSON from PHP to JavaScript?
- Can’t use method return value in write context
- PHP get domain name
- Prioritize Visible Content WordPress
- Unexpected Exception: SQLSTATE[HY000] [1045] Access denied for user ****@’localhost’ (using password: YES)
- PHP json_decode() returns NULL with valid JSON?
- Why do I have to run “composer dump-autoload” command to make migrations work in laravel?
- file_get_contents(“php://input”) or $HTTP_RAW_POST_DATA, which one is better to get the body of JSON request?
- file_get_contents( ) not working
- What is unexpected T_VARIABLE in PHP?
- How to close Browser Tab After Submitting a Form?
- How to make DROP INDEX IF EXISTS for mysql?
- get type in php returns “object” and not the object type
- How to find out if you’re using HTTPS without $_SERVER[‘HTTPS’]
- Returning JSON from a PHP Script
- PHP Warning: PHP Startup: Unable to load dynamic library
- Do I need a !DOCTYPE declaration in a php file with html?
- How get value from URL
- How can I parse a JSON file with PHP? [duplicate]
- Object of class stdClass could not be converted to string
- How to get URL of current page in PHP
- WordPress visual composer not loading
- What does “zend_mm_heap corrupted” mean
- Start and stop a timer PHP
- Adding days to $Date in PHP