...

View Full Version : sessions... Object ID #1



NancyJ
06-15-2006, 01:51 AM
I'm having session trouble, sometimes when I try to echo out a session value - i get Object ID #1 instead.... anyone know why that is?

xconspirisist
06-15-2006, 03:22 AM
You are improbably trying to echo an object.

Show me some of your code.

Generally, you access session variables like this:



<?php

echo $_SESSION['myvar'];

php?>

Curtis D
06-15-2006, 03:25 AM
It seems you have stored an object in your session variable. If you are using PHP 5, you can change how an object will behave when handled as a string (See __toString() in php.net's manual: Magic Methods (http://php.net/manual/en/language.oop5.magic.php)).

It's hard to tell exactly what the problem is without seeing your code.

@xconspirisist : your PHP delimiter tags are incorrect. The closing PHP tag is ?> not php?>

NancyJ
06-15-2006, 08:34 AM
ahhhh, interesting. I wasnt trying to store an object in my session BUT the name of the session variable was the same as an object I had. I changed the name of the session variable and it was fine.

Curtis D
06-15-2006, 12:23 PM
That's understandable, especially when writing larger scripts. I'm glad to hear it wasn't a serious problem. :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum