header white Data |
Hello everybody,
I wanted to include a loop in my template header.php. Unfortunately I get with the foreach an error message. What have I done wrong? Controller: PHP Code: <?php Model: PHP Code: <?php header.php Code: <?php foreach ($header_warenkorbs as $warenkorb): ?>
What error are you getting you did not show one?
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Sory forgettet
Quote:A PHP Error was encountered
You should always check a foreach variable is not empty before doing the foreach loop. The error is telling you your variable is not set. If it is not set, but you are trying to set it with your model call, then your model must not be returning the values you expected.
Looking at your models called function, which looks fine, are you sure you have any data in the table you refer to? PS You could write it like this btw: PHP Code: public function header_warenkorbs() And since select * is the default, and get accepts a table name, you could do: PHP Code: public function header_warenkorbs() Paul |
Welcome Guest, Not a member yet? Register Sign In |