Help with session and object Plz
Posted: Fri Oct 10, 2003 12:53 pm
Okay i know this question has been asked numerous times but i haven't been able to find a solution for my problem. I can store objects in session and am able to access its methods just fine but problem arises when that object has other objects of it's own.
Well that gives an error when it tries to access db->connect()...
Help me!!!
Code: Select all
//file: start.php
<?php
//Header
include("JobInterface.inc");
session_start();
if(!is_object($jobInterface))
{ echo "creating object";
session_register('jobInterface');
$jobInterface = new JobInterface();
}
if(session_is_registered('jobInterface');
$jobInterface->test();
?>
//file: jobInterface.inc
<?
include("Database.inc");
class JobInterface {
var $db;
function JobInterface()
{ $this->db = new Database("");
}
function test()
{ $this->db->connect();
}
}
?>Help me!!!