![]() |
[newbie] I need help (database listing) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: [newbie] I need help (database listing) (/showthread.php?tid=18957) |
[newbie] I need help (database listing) - El Forum - 05-23-2009 [eluser]Wievior[/eluser] Hello, I am completely new to CodeIgniter and I encountered a problem while learning from a tutorial I found on the Internet. Here's the code: Model: Code: <?php Controller: Code: <?php It's in polish but I guess that it shouldn't be a problem. Until I put in the listuj() function everything worked just fine, the form, validation, inserting into database (checked it with PMA). However - when I inserted this function I get an error: Quote:Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /mypage/formularz.php on line 30 Line 30 being the one with foreach. Something with result() seems to be wrong. But as I said, I just started my journey with CI so I don't really know how to fix it. Any help/advise would be greatly appreciated. Regards, Paul [newbie] I need help (database listing) - El Forum - 05-23-2009 [eluser]geocine[/eluser] Where is the formularz.php please paste it. Change this: Code: foreach ($this->News->get_news()->result() as $val) To this: Code: $qs = $this->News->get_news(); so that get_news() is not called every loop. [newbie] I need help (database listing) - El Forum - 05-24-2009 [eluser]Wievior[/eluser] The Controller is formularz.php ;] How did I not see that? :| thanks a lot, works like a charm! :] |