Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] Proste zapytanie
coolin1986
post 18.03.2008, 11:10:17
Post #1





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 3.03.2008
Skąd: Białoruś

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


Mam taki skrypcik. Chciał bym zrobic prostego selecta. Zrobiłem selekta (jest właśnie zakomentowany), jak probuje uruchomić wywala mi tysiąc błedów, bez tego selecta wszystko działa. Proszę o pomoc

myprojekt/application/controllers/IndexController.php:

  1. <?php
  2. class IndexController extends Zend_Controller_Action {
  3.  function init() {
  4. $this->view->baseUrl = $this->_request->getBaseUrl();
  5. Zend_Loader::loadClass('Oferty');
  6.  }
  7.  function indexAction() {
  8.  
  9. $offer = new Oferty();
  10.  $result = $offer->fetchAll();
  11.  $this->view->offers = $result;
  12.  
  13. //  $sql = 'SELECT * FROM ns_offer';
  14. //  $result = $offer->fetchAll($sql);
  15. }
  16. ?>


myprojekt/application/models/Oferty.php :

  1. <?php
  2. class Oferty extends Zend_Db_Table {
  3.  protected $_name = 'ns_offer';
  4. }
  5. ?>


myproject/index.php :

  1. <?php
  2. error_reporting(E_ALL|E_STRICT);
  3. date_default_timezone_set('Europe/London');
  4. set_include_path('.' . PATH_SEPARATOR . './library'
  5.  . PATH_SEPARATOR . './application/models/'
  6.  . PATH_SEPARATOR . get_include_path());
  7.  
  8. include "Zend/Loader.php";
  9. Zend_Loader::loadClass('Zend_Controller_Front');
  10. Zend_Loader::loadClass('Zend_Config_Ini');
  11. Zend_Loader::loadClass('Zend_Registry');
  12. Zend_Loader::loadClass('Zend_Db');
  13. Zend_Loader::loadClass('Zend_Db_Table'); 
  14.  
  15.  
  16. // load configuration
  17. $config = new Zend_Config_Ini('./application/config.ini', 'general');
  18. $registry = Zend_Registry::getInstance();
  19. $registry->set('config', $config); 
  20.  
  21. // setup database 
  22. $db = Zend_Db::factory( $config->db->adapter,
  23. $config->db->config->toArray() );
  24. Zend_Db_Table::setDefaultAdapter($db);
  25.  
  26.  
  27.  
  28. // setup controller
  29. $frontController = Zend_Controller_Front::getInstance();
  30. $frontController->throwExceptions(true);
  31. $frontController->setControllerDirectory('./application/controllers');
  32.  
  33. // run!
  34. $frontController->dispatch();
  35. ?>


Ten post edytował coolin1986 18.03.2008, 11:13:12


--------------------
webdesign hamburg
werbung hamburg
GRAND MEDIA
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 Wersja Lo-Fi Aktualny czas: 23.09.2024 - 20:24