Cannot use object of type stdClass as array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Cannot use object of type stdClass as array (/showthread.php?tid=66320) |
Cannot use object of type stdClass as array - davy_yg - 10-07-2016 Hello, How to fix this error message? Can you help? Fatal error: Cannot use object of type stdClass as array in C:\Program Files\EasyPHP-Devserver-16.1\eds-www\companygiondaci\application\views\pcategories.php on line 56 A PHP Error was encountered Severity: Error Message: Cannot use object of type stdClass as array Filename: views/pcategories.php Line Number: 56 Backtrace: views/pcategories.php PHP Code: <div class="row-fluid"> controllers/Cpages.php PHP Code: public function pcategories() { models/Mpages.php PHP Code: public function call_parentctg() RE: Cannot use object of type stdClass as array - ciadmin - 10-07-2016 This is at least the third time you have asked this same question, in slightly different contexts. RE: Cannot use object of type stdClass as array - InsiteFX - 10-08-2016 He just does not know the difference between an array and a object. RE: Cannot use object of type stdClass as array - RogerMore - 10-10-2016 Everybody raise your hand if you're getting tired of this guy flooding the forum with beginner PHP problems trying to find people to do the coding for him... *** raising both hands! *** RE: Cannot use object of type stdClass as array - salain - 10-10-2016 The easiest way to fix this error and probably the only way in your case is to hire someone to finish your project. RE: Cannot use object of type stdClass as array - PaulD - 10-10-2016 (10-10-2016, 02:20 AM)RogerMore Wrote: Everybody raise your hand if you're getting tired of this guy flooding the forum with beginner PHP problems trying to find people to do the coding for him...*** raising both hands too! *** (10-10-2016, 03:20 AM)salain Wrote: The easiest way to fix this error and probably the only way in your case is to hire someone to finish your project.LOL - So true and so funny. It is not that he is a beginner, it is the apparent lack care and attention to the most blindingly obvious things. And a reputation of -30 says quite a lot in itself. One thing I have loved about learning PHP is that it is very easy to learn. The error messages are usually extremely helpful. The language is extremely well documented. CI is the same, extremely easy to learn, exceptional documentation, very good error logging and messaging. Even after years of use I find PHP funtions that amaze me, and CI functionality that is exceptionally useful. We all get stuck on basic things on occasion, but to not read documentation, to not read the php error messages, to not learn why something is wrong instead of just fixing it, to not read the many many online resources available, to not look through the hundreds of examples, to not learn from others, but to keep asking the same things again and again, is just simply frustrating. For ages I thought he was a troll, just having a laugh. I find his posts quite amusing and do not think he should be banned. I have just stopped responding to them. (Except this one but I am at home, a bit bored, waiting for an Amazon delivery). RE: Cannot use object of type stdClass as array - RogerMore - 10-10-2016 Hey PaulD, There was a time that some of the problems he came up with were funny. Nowadays they mainly irritate me. Don't get me wrong, there's nothing wrong with beginners questions. One of the reason's I come to the forum is to help an occasional fellow CI user when I have the time, beginner or not. It's starting to look a little disrespectful to people who try to help others, when it is obvious that this person doesn't have the decency spend a couple of minutes reading error messages or use the search box of the CI user manual or Google for that matter. Sometimes this guy is in more than 3 or more of the 10 latest threads, while there are other people with real questions who also are trying to get their problems solved... I wouldn't mind a new feature added to the forum where I can use the Ignore list to filter this guy's posts out of the posts list... -Roger RE: Cannot use object of type stdClass as array - Wouter60 - 10-10-2016 He probably thinks that a reputation of -30 is a php error also. RE: Cannot use object of type stdClass as array - wolfgang1983 - 10-11-2016 Because it's an array http://www.codeigniter.com/user_guide/database/results.html Code: return $query->result_array(); http://www.codeigniter.com/user_guide/database/results.html?highlight=result_array#CI_DB_result::result_array PHP Code: <?php foreach ($posts as $post) {?> If you want to use result then Code: return $query->result(); On view some thing like PHP Code: <?php foreach ($posts as $post) {?> Fully read manual. |