Results 1 to 4 of 4

Thread: [RESOLVED] Session variables

  1. #1

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Resolved [RESOLVED] Session variables

    Hi,


    Treading quietly into the world of Php/MySql I am experimenting...

    Now if you picture a mad scientist type, you'd have the white lab coat with some weird colours in place and perhaps a singe mark near the bottom, goggles on (bit of sellotape holding the strap). and the scientist is pouring two flasks of liquid together. Now the scientist is expecting a colour change, however the liquid is clear.

    The problem:
    On the index page I am getting a check of session variables. Just looping through all of them.
    Then on a login php processing page it fills session variables.
    However, when going back to the index page only one variable is there (UserID) which is weird. Should be 5 at least. So I check the processing page, 5 listed.
    Back to the main page. 1 again ...
    So I put in a clear session vars loop in the php, and run it.
    Now no vars available.
    The index page still has one var - UserID.

    What is going on?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Session variables

    When you say 5 listed, do you mean 5 UserID's? Can you post some code so we can see whats happening exactly

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Session variables

    Have you initialised the session correctly on the index pages?
    Last edited by penagate; Mar 21st, 2006 at 10:33 AM. Reason: minorly catastrophic spelling error. Couldn't have that now could we!

  4. #4

    Thread Starter
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Session variables

    john - 5 variables held on the session object

    penagate - Uh apparently not.


    After a little head bashing and a minor headache. Some delving on php.net and in a wrox book, I needed to put session_start() at the beginning of every page that needed to use the session variables.

    So thats better and appears to (almost) work the way I want.

    I'm doing the simplistic log on screen. Anyway. Thanks for the pointers.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width