Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Problem reading properties of object passed in session

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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
McMurphy-
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed Apr 02, 2003 11:15 pm

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*
Skeletor
New php-forum User
New php-forum User
 
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron