homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

PHP session problem
Variables not remembered

 4:44 am on Mar 27, 2003 (gmt 0)

I'm using my custom session_save_handler, storing information in a database. It works great as far as starting a session. The information is stored in a MySQL database, and that works just fine. However, when I go to the next page the variable is no longer registered, and it has lost its value.



 5:22 pm on Mar 27, 2003 (gmt 0)

Not really sure, do you call session_start [php.net] every time?


 6:11 pm on Mar 27, 2003 (gmt 0)

maybe I don't quite get it but I was looking at

the comments and examples may be in the neighbourhood of your question, not 100% sure though.


 9:46 pm on Mar 27, 2003 (gmt 0)

Yep, call session_start() at the top of each page. It recognizes the SID, but that's about it.

I've looked at the PHP site, but it wasn't too helpful. All the customized functions are called (tried to echo something from within the function, and it gets printed)... I just can't figure out why my session variables are lost :(


 12:55 am on Mar 28, 2003 (gmt 0)

Hmm... I just noticed that the cookies don't work either :(
It defaults to rewriting the URL...

I've successfully used PHP sessions before, but now I wanted to handle session storage in a MySQL database... and it's not working the way I want it to :)


 1:28 am on Mar 28, 2003 (gmt 0)

are you doing session_register?


$var1 = '10';


 6:40 am on Mar 28, 2003 (gmt 0)

Yes, I'm registering the variables...


 8:33 am on Mar 28, 2003 (gmt 0)

What's your reigster_globals setting?

I believe you have to use $_SESSION['blurgh'] everywhere (inluding inside the session_register when register_globals is off.

The PHP manual is your friend :)
And read the notes too :)



 6:12 pm on Mar 28, 2003 (gmt 0)

register_globals is on...
And I've consulted the manual a lot, and read the notes, and ...

I rewrote the whole thing, and now it works... Except for the cookies... Has anyone else had that problem?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved