smileyriley21
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by smileyriley21
-
-
Hi,
I am experiencing an intermittant error "Call to a member funtion on a non object" using php objects as session variables.
My program structure stores the customer object as session variables. For instance, when a customer logs in I generate a customer object and store this as their session variable (with name, email etc etc). This gives me easy access to the information I need, when I need it.
Every now and then the error "Call to a member function on a non object" occurs. However, this is intermittant and does not follow any pattern.
I have experience this error when a customer continually refreshes the page. In this instance the session var is lost and therefore the object error occurs.
Here is an example..
$cust= unserialize($_SESSION['cust']);
$cust->doSomthing();
$cust= serialize($cust);
If the client refreshes the page whilst the function doSomthing() is called, the session var is lost.
Really, I need some advise on this? How can I ensure the session variable is not lost?
Many thanks, in advance
Dak
Session, Objects and Errors :0(
in PHP Coding Help
Posted
you must put session start at the top of the page to hold the varables on all pages.
[code]
<? session_start();
?>
[/code]
[/quote]
I do have this on each page, the problem only occurs every now and then..
regards