Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Zend Wyświelanie danych z bazy.
cykcykacz
post
Post #1





Grupa: Zarejestrowani
Postów: 550
Pomógł: 9
Dołączył: 29.05.2009
Skąd: Ostrów Wielkopolski

Ostrzeżenie: (0%)
-----


Witam nie wiem czemu ale nie wyświetla mi danych w widoku.
Model
  1. class Model_Items extends Zend_Db_Table_Abstract
  2. {
  3. protected $_name = 'articles';
  4. protected $_primary = 'i_id';
  5. public function selectwhere($id)
  6. {
  7. $db = $this->getAdapter();
  8.  
  9. $select = $db->select()
  10. ->from($this->_name)
  11. ->where('i_id = ?', $id);
  12.  
  13. $result = $select->query()->fetch();
  14.  
  15. if (!$result) {
  16. return false;
  17. }
  18.  
  19. $params = array();
  20. $params['db'] = $db;
  21. $params['table'] = $this;
  22. $params['data'] = $result;
  23.  
  24. return new Zend_Db_Table_Row($params);
  25. }
  26. }

Kontroller
  1. public function expositionAction()
  2. {
  3. // action body
  4. $itemsDAO = new Model_Items();
  5. $id = 1;
  6. $itemsDAO->selectwhere($id);
  7. // print_r($itemsDAO);
  8. //print_r($itemsDAO);
  9. $this->view->select = $itemsDAO;
  10. }

widok
Kod
<div id="content">
<?php //echo $this->select; ?>
        <?php foreach($this->select as $item): ?>
    
            <div id="Articles">
                <div id="Title"><?php echo $item->i_name ?></div>
                <div class="text"><?php echo $item->i_text ?></div>
            </div>            

        <?php endforeach; ?>

</div>
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 10:04