php - fuelphp -Undefined variable -
i have book model view controller , have library controller , view . view folder has index.php
, view.php
. question in index.php following error:
errorexception [ notice ]: undefined variable: books
here code in index.php file:
<h2>library</h2> <?php foreach ($books $books): ?> <h3><?php echo html::anchor('library/view/'.$book->id, $book->title)?></h3> <p><?php echo $book->description?> </p> <?php endforeach ?>
you got 2 errors there. 1 $books
array not initialized (hence warning), other foreach()
wrong. replace this:
<?php foreach ($books $books): ?>
with
<?php foreach ($books $book): ?>
but still need find missing $books
array
This comment has been removed by the author.
ReplyDelete