Mam 4 pliki:
index.php (główny):
<?php
include "stronaclass.php";
...
?>
stronaclass.php (klasa z różnymi funkcjami)
include "laczeniezbaza.php";
class funkcje {
function drukuj($id) {
$db->db_getData("SELECT * FROM posts WHERE id=".$id); //tutaj błąd
...
}
}
laczeniezbaza.php
require "dbclass.php";
$db=new dbclass();
...
$db->db_connect();
dbclass.php
class dbclass {
...
function db_getData($query) {
$this->db_query($query);
$this->i=0;
while($data=mysql_fetch_array($this->result)) {
$this->i++;
$this->datafromdb[$this->i]=$data;
}
}
...
}
Fatal error: Call to a member function db_getData() on a non-object in /stronaclass.php on line 5
Proszę o pomoc.