Jump to content
Larry Ullman's Book Forums

Storing Sessions In Database Query

Recommended Posts



I am having problems understanding just how to use this. On page 84 there is a diagram showing the procedural flow.


I can successfully create the session and load some data into it.  A check of the database table shows that the data is correctly loaded.


The problem that I am having is retrieving that data in a separate PHP script.  The comment on the bottom of the diagram says that every time that a session is started the 'open' and 'read' functions are called. 


How do I 'see' what is in the session in the second script, i.e., one that gets invoked after the session is initially created?


If I do a if (empty($_SESSION)) (after the 'session_start()') it tests as empty?


If I do a get_defined_vars(), again after the 'session_start()', it shows that the session is empty?


My environment is:

. Windows 7 Home Premium 64 bit
. Internet Explorer 10
. Firefox 22.0
. Dreamweaver CS5 as the text editor

. XAMPP for Windows 1.8.3 which comprises:

.. Apache 2.4.4

.. PHP 5.5.3

.. MySQL 5.6.11

.. phpMyAdmin 4.0.


Any help will be most appreciated.


Thanks, Necuima

Link to post
Share on other sites

OK, found what I was doing wrong.


I probably didn't read Larry's notes closely enough.


In a nutshell, I interpreted the 'session_start()' literally (Figure 3.4 - the 'some other script'). What I needed to do was to include the db_sessions.inc.php file which starts the session anyway.


Posted here in case it may help someone else!


Cheers from Oz, Necuima.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...