Possible Duplicate:
Can't pass mysqli connection in session in php
I'm trying to store a custom-made PHP MySql class into the $_SESSION. When accessed, PHP throws an error saying: "The script tried to execute a method or access a property of an incomplete object ... ".
include_once 'core/mysql.php';
$conn = new mysql();
$_SESSION['DBCONNECTION'] = new mysql();
$result = $_SESSION['DBCONNECTION']->query_cust($sql); // Fails!
$result = $conn->query_cust($sql); // Works!
I'm just tying to understand how the Sessions in PHP work and what makes the difference between defining the class as a normal variable and a variable inside $_SESSION
!?
var_dump($_SESSION['DBCONNECTION'])
returns:
object(__PHP_Incomplete_Class)[1]
public '__PHP_Incomplete_Class_Name' => string 'mysql' (length=5)
public 'con' => int 0