Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] Call to a member function on a non-object
cornholio666
post
Post #1





Grupa: Zarejestrowani
Postów: 472
Pomógł: 8
Dołączył: 14.03.2004
Skąd: Rzeszów

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


Witam,

plik1:

  1. <?php
  2. include "../adodb/adodb.inc.php"; 
  3.  
  4.  $db = NewADOConnection('mysql');  
  5.  $db->Connect("", "", "", "baza");  
  6.  
  7.  include "./news.class.php";
  8.  include "./newsy.class.php";
  9.  
  10.  
  11.  $newsy = new Newsy($db);
  12.  $newsy->show_all_news();
  13. ?>


newsy.class.php:

  1. <?php
  2. class Newsy{
  3.  
  4.  var $tab_news = array();
  5.  var $db;
  6.  
  7.  function __construct($db){
  8.  $this->db = $db;
  9.  }
  10.  
  11. function show_all_news(){
  12.  
  13. $query = "SELECT news_id,title,prev_content,content,date FROM news ORDER BY news_id D
    ESC"
    ;
  14. //echo $query;
  15. $result =$this->db->Execute($query);
  16.  
  17. if (!$result){
  18. die("failed1");
  19. }
  20.  
  21. while(!$result->EOF){
  22.  
  23. $news = new News($this->db);
  24.  
  25. $news->news_id = $result->fields[0];
  26. $news->title = $result->fields[1];
  27. $news->prev_content = $result->fields[2];
  28. $news->content= $result->fields[3];  
  29. $news->date = $result->fields[4];
  30. array_push($this->tab_news,$news);
  31.  
  32. $result->MoveNext();
  33. }
  34.  
  35.  
  36.  }
  37.  
  38.  }
  39. ?>


Wyskakuje błąd:

Call to a member function on a non-object in newsy.class.php on line 16

16 linijka:
  1. <?php
  2. $result =$this->db->Execute($query);
  3. ?>


Na lokalu mi chodzi elegancko a na serwerze taki blada wywala. Jakies pomysły?


--------------------
I need TP for my bunghole!!!

Mój nowy przyjaciel - tytanowa płytka na stałe
------------------------------------------------------
AEGEE, kwiaciarnia rzeszów , notariusz rzeszów, zakład krawiecki rzeszów, paweł jakubowicz
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 - 01:02