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