I have an array of objects with multiple keys in php:
Array
(
[0] => stdClass Object
(
[ID] => 4983
[post_id] => 56357
[date] => 2016-06-04 23:45:28
)
[1] => stdClass Object
(
[ID] => 4982
[post_id] => 56241
[date] => 2016-06-04 22:58:27
)
)
Then I am using the following to change the date format:
foreach($results as &$row) {
$row['date'] = ago($row['date']);
}
However I keep getting Cannot use object of type stdClass as array error.
Any suggestions to why it is occurring?
mysql_fetch_*functions. Your$resultvariable is aresource(php.net/manual/en/function.mysql-query.php)date.