homepage Welcome to WebmasterWorld Guest from 54.161.240.10
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
DrDoc




msg:1316727
 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.

 

jatar_k




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

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

jatar_k




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

maybe I don't quite get it but I was looking at
[php.net...]

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

DrDoc




msg:1316730
 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 :(

DrDoc




msg:1316731
 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 :)

gethan




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

are you doing session_register?

eg.

session_start();
$var1 = '10';
session_register('var1');

DrDoc




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

Yes, I'm registering the variables...

Allen




msg:1316734
 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 :)

Allen

DrDoc




msg:1316735
 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