Code Comments
Programming Forum and web based access to our favorite programming groups.I hava a class that i use to connect with my db. After I instantiate the
class and I am connected with the database i save the connection link to a
property, which is a resource type.
I want to pass the whole object that i am creating and use the connection
inside another class. But when i do sth like the following there is a fatal
error that the mysql link is not a valid resource identifier.
class connection{
var $link;
function connect(){
$this->link = blalba
}
}
class thirdClass(){
var $connectionObject;
function thirdClass($connectionObject){
$this->connectionObject = $connectionObject;
}
function test(){
$this->connectionObject->executeQuery($query);
}
$myConnection = new Connection();
$myConnection->connect();
$myObject = new $thirdClass($myConnection);
I tried to serialize the object but that is meaningless as when you
serialize an object it is not saved the resource type.
Yiannis
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.