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


Comments

Post a Comment

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -