![]() |
Edit Pages - 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: Edit Pages (/showthread.php?tid=66040) |
Edit Pages - davy_yg - 08-27-2016 How to fix this error message? A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: views/editpages.php Line Number: 49 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\views\editpages.php Line: 49 Function: _error_handler File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\Cpages.php Line: 269 Function: view File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php Line: 315 Function: require_once Line 49: PHP Code: <?php foreach ($pages as $pages_item): ?> views/editpages.php PHP Code: <?php //$pages=array(); ?> RE: Edit Pages - InsiteFX - 08-27-2016 When are you going to quit writing code and start to learn the languages and frameworks? RE: Edit Pages - davy_yg - 08-27-2016 Sorry, I thought that is CI framework. And I know somethings about php - already 4 years with php. Eventhough some errors makes me question something? RE: Edit Pages - ciadmin - 08-27-2016 Davy: the error message you are questioning is pure PHP ... "Invalid argument supplied for foreach()". The $pages variable is either empty or undefined. That should be apparent to someone with four years of PHP ![]() RE: Edit Pages - PaulD - 08-27-2016 Should be apparent with four weeks of php. RE: Edit Pages - davy_yg - 08-27-2016 Lol. I think I am still new in this part and perhaps better on other part. I already read the manual and still do not understand it. http://php.net/manual/en/control-structures.foreach.php I try to activate this: <?php $pages=array(); ?> <?php foreach ($pages as $pages_item): ?> RE: Edit Pages - davy_yg - 08-27-2016 This is the models: models/Mpages.php PHP Code: public function update_pages($pages_id) RE: Edit Pages - InsiteFX - 08-28-2016 Learn to program in PHP RE: Edit Pages - davy_yg - 08-28-2016 I have read the tutorial. I only do not know how to fix this error message: A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: views/editpages.php Line Number: 49 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\views\editpages.php Line: 49 Function: _error_handler File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\Cpages.php Line: 269 Function: view File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php Line: 315 Function: require_once Line 49: PHP Code: <?php foreach ($pages as $pages_item): ?> RE: Edit Pages - ciadmin - 08-28-2016 Davy: I repeat, the $pages variable is either empty or undefined. The model snippet you provided earlier does not set $pages, as far as I can see. In line 49 of your post above, where does $pages come from???????????? It is empty or undefined!!!!!!!!!!!!! |