help on how to loop .. displaying all data on database.. |
[eluser]besingamk[/eluser]
hi im new on codeigniter and i cant loop this one.. please help me. all i need is to loop the codes as long as it has data on database heres my controler: Code: public function homepage() and heres my model: Code: <?php heres my view: Code: <?php
[eluser]Rowan Wilson[/eluser]
Something like this: Code: <?php if ($result): ?>
[eluser]besingamk[/eluser]
Thank you sir.. I hope thats its the answer to my problem..
[eluser]besingamk[/eluser]
[quote author="Rowan Wilson" date="1357559740"]Something like this: Code: <?php if ($result): ?> sir how about if i want 5 items only to be display.. ??
[eluser]Rowan Wilson[/eluser]
Quote:sir how about if i want 5 items only to be display.. ?? In your model: Code: $query = $this->db->query("SELECT * FROM film WHERE film_id = film_id ORDER by film_id DESC LIMIT 5"); Have a look into Active Record though. Unless your query is massively complicated it will do all that you require: http://ellislab.com/codeigniter/user-gui...ecord.html That way you can pass through the limit from your controller/view. If you so wish.
[eluser]besingamk[/eluser]
i am very thankful for your reply sir. it helps me a lot to my project and to understand CI more.. |
Welcome Guest, Not a member yet? Register Sign In |