Standardowo stworzyłem tak (oczywiście to tylko kawałki kodu):
index.php
<?php $db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray()); Zend_Db_Table::setDefaultAdapter($db); ?>
IndexController.php
<?php function announcementsAction() { $this->view->title = "Ogłoszenia"; $announcements = new announcements(); $this->view->row_announcements = $announcements->fetchAll(); } ?>
Announcements.php (model)
<?php class Announcements extends Zend_Db_Table { protected $_name = 'announcements'; } ?>
announcements.phtml (wyświetlanie)
<?php foreach($this->row_announcements as $row) : ?> <!-- jakieś tam wyświetlanie w htmlu --> <?php endforeach; ?>
I moje pytanie brzmi, jak mam utworzyć sobie własne zapytanie? Tzn. chciałbym np. dodać klauzule ORDER BY oraz LIMIT.
Z góry dziękuję za odpowiedź.
P.S.: Oczywiście mowa o mysql.