Problem reading properties of object passed in session

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

McMurphy-
New php-forum User
New php-forum User
Posts: 3
Joined: Wed Apr 02, 2003 11:15 pm

Problem reading properties of object passed in session

Postby McMurphy- » Mon Apr 21, 2003 9:41 am

Hello ppl,

I'm passing an object as a variable using session_register() but can't seem to access its properties.

Code: Select all

<?php
session_start();
if(isset($testObj)){
   echo "object is here<br>";
   echo "object prop1 is".$testObj->prop1;
}else{
   echo "No object here mate";
}
?>


The IF indicates that the variable is set and is accessible. prop1 returns a result in the 1st page where the object is created from a class. Any ideas?

Cheers,

McMurphy

User avatar
Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

Postby Skeletor » Mon Apr 21, 2003 10:00 am

do you have to refer to it as $_SESSION[$var] ? If globals is turned off, then this might be your problem. *shrugs*


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests