Hey guys,
I've made a Connection class that returns a variable $conn that is the link identifier for this open connection. However, when I try store this as a Session value, and then use it in another page, I am getting error messages it is telling me it is an invalid reference/link identifier. Does anyone have any idea of how I could do this?
e.g. : Code Example
function Connection() {
$this->conn = mysql_connect(
$this->host, $this->username, this->password) ;
mysql_select_db($this->databaseName, $this->conn) ;
} // end connect()
function getConnection() {
return $this->conn ;
} // end getConnection()
Then storing :
$c1 = new Connection() ;
$conn = $c1->getConnection()
If I then store it as a Session variable :
$_SESSION['conn'] = $conn ;
and try to use this in another page, I am getting error messages.
Does anyone have any idea why this is so and/or a possible way around it? Or a better way of doing so?