[Solved] Output last 5 rows in database [CakePHP] [closed]


You have to use find()

Other way is to use query()

$alltext = $this->Text->find('all', array('limit' => 5,'order'=>array('id DESC')));
<?php foreach ($alltextext as $text): ?>
 // format as necessary
<td><?php echo $text['Text']['id']; ?></td> 
// add others here
<?php endforeach; ?>

3

solved Output last 5 rows in database [CakePHP] [closed]