Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> problem z obiektem
ARJ
post
Post #1





Grupa: Zarejestrowani
Postów: 453
Pomógł: 22
Dołączył: 20.09.2004
Skąd: Kraków - NH -

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


witam. ostatnio wziołęm się za obiekty. napisałem coś takiego jednak mam problem.
  1. <?php
  2. $conf = parse_ini_file(&#092;"config.php\");
  3. class DB{
  4. var $result;
  5. var $wynik;
  6. var $ustaw;
  7. var $polonczenie;
  8. function DB(){
  9. $this->ustaw = parse_ini_file(&#092;"config.php\");
  10. $this->polonczenie = mysql_connect($this->ustaw['host'], $this->ustaw['user'], $this->ustaw['pass']);
  11. mysql_select_db($this->ustaw['table'], $this->polonczenie);
  12. }
  13. function query($zapytanie){
  14. $this->result = mysql_query($zapytanie, $this->polonczenie);
  15. }
  16. function fetch($co){
  17. $this->wynik = array();
  18. $ilosc = mysql_num_rows($co);
  19. for($i = 1; $i <= $ilosc; $i++){
  20. $this->wynik[] = mysql_fetch_array($co);
  21. }
  22. }
  23. }
  24. class templates{
  25. var $lista;
  26. var $wynik;
  27. var $baza;
  28. function zmien($wco){
  29.  
  30. }
  31. function lista(){
  32. $this->baza = new DB;
  33. $this->baza->query(&#092;"SELECT * FROM `szablony` ORDER BY `aktywny` DESC\");
  34. $this->baza->fetch($this->baza);
  35. }
  36. }
  37. $tpls = new templates;
  38. $tpl = new Smarty;
  39. $tpls->lista();
  40. $tpl->assign(&#092;"szablon2\", $tpls->wynik);
  41. ?>

gdy użyje samej klasy DB otrzymuje wynik. jednak gdy klasa templates próbuje wyciągnąć z bazy liste szablonów wyskakuje
Cytat
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\program files\easyphp\www\mysp\index.php on line 31

gdzie jest błąd? co robie nie tak? już kilka możliwości próbowałem, szukałem lecz nic nie działa. z góry dzięki za pomoc.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 23.08.2025 - 19:31