[SOLVED] Foreach loop runs OK on localhost, but fails online - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [SOLVED] Foreach loop runs OK on localhost, but fails online (/showthread.php?tid=41038) |
[SOLVED] Foreach loop runs OK on localhost, but fails online - El Forum - 04-26-2011 [eluser]Arministrator[/eluser] First off, Hi great Codeigniter community. I've been present as a guest on forums for a while now, but this is my first post. I've browsed and searched and googled first, for a solution of what should be a tiny problem for you guys, but in the end I had to start this topic. I'm using a really simple getAll function in my model to retrieve data. That function is called from a controller and passes the data as an array to the view. And it all works fine on localhost (WAMP), but fails online. I'm baffled. The Model: Code: <?php The Controller: Code: <?php The View: Code: <?php foreach($rows as $r):?> All of this stuff is more or less from the Net Tuts CI series. I've seen this problem posted in comments, but no solution. And this is really a tripping point for me, because how do I know that I'm doing anything right (or wrong) if it works locally and fails online. Again, sorry if this has been discussed before. EDIT: Oh, this is the error I get: A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: views/content.php Line Number: 2 [SOLVED] Foreach loop runs OK on localhost, but fails online - El Forum - 04-26-2011 [eluser]Arministrator[/eluser] Aren't I stupid: My online database was empty. |