I think I’m too tired for this. Need a fresh mind.
Class A {
function A () {//constructor
include ( 'db.php' );
$this->db = new DB();//responsible for database operations
$this->C = new C();//when instanciated, should echo those records
}
function get_records () {//returns a number
return $this->db->RecordCount ( 'SELECT * FROM bla bla' );
}
}
$class = new A();
Class C {
global $class;
function C () {//constructor
echo $class->get_records ();
}
}When I do this I get an error that $class is not an object (call to a member function on a non object) at this line:
echo $class->get_records ();Any idea why?
P.S. This has nothing to do with CI