I'm trying to pass an object onto different pages within a session.
The object that is created is to give a user some utilities to work with. The definition of the class is in the file 'ezconnection.php'.
My code looks like this:
frm_user.php:
<?php
include_once('ezconnection.php');
session_start();
...
if(!session_is_registered("objconnection")){
session_register("objconnection");
}
$objconnection = new ezconnection(HOST, DB, WEBUSER, WEBPASSWORD);
$compact_objconnection=serialize($objconnection);
?>
change_personal.php:
<?
...
$objconnection=unserialize($compact_objconnection);
$qry_personalia="SELECT * FROM e_persons INNER JOIN e_projects_persons ON e_persons.projects_persons_fk=e_projects_persons.e_projects_persons_pk
WHERE e_persons_pk='$e_persons_pk'";
$objconnection->set_query($qry_personalia);// line 17
...
?>
Every time I try to access the link I get the following error:
Fatal error: Call to a member function on a non-object in change_personal.php on line 17
Do I need to serialize and unserialize the object or not?
And if so, why is going wrong here?
Final comment: 'change_personal.php' is reached through a href="change_personal.php" link in frm_user.php.
Please help.
Thank you.