Welcome to WebmasterWorld Guest from 54.226.62.251

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP session problem

Variables not remembered

     

DrDoc

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

jatar_k

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

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



are you doing session_register?

eg.

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

DrDoc

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Yes, I'm registering the variables...

Allen

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

10+ Year Member



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

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

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month