I'm trying to set a object as global for access through out the rest
of my script ... {a basic SQL accessing object} however if I try
calling the object from with in another object it acts as if it isn't
global and hasn't been accessed at all ... weather I decalre it from
inside the object or declare it outside the object
I would rather not have to resort to the standard of refrenceing sence
I plan on having modular support and having this one object be a
global rathen then everyone refrencing it would just be easyer for
people to understandanywa ys heres some of the code
and mind you this is pretty basic so far
---------index.php----------------
<?php
include_once("c onfig.php");
include_once("l ibs/mod.class.php") ;
include_once("l ibs/DataBase.class. php");
include_once("l ibs/main.class.php" );
$site= new main();
$site->init();
$site->loop();
$site->close();
?>
--------end------------------------
--------main.class.php-----------
<?php
global $db;
class main {
function init () {
global $db;
$db = new DBAccess($confi g['database']);
}
function loop () {}
function close () {
$db->DBKill();
}
}
?>
----end-------------------------
---error------------------------
Fatal error: Call to a member function on a non-object in
main.class.php on line 11
-------------end----------------
I would rather get this finished before continuing to work on the code
sence accessing the database will lead to 90% of the work after this
and I have googled for the answer already and come up rather dry