Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    Angry session problems

    I am having a problem with some session data.

    I need to test wether any session data has been set and if it hasn't then I need to display a message. Session data should only be set when a user adds an item to his order. This creates a session var where the key of this is the product key. Therfeor I can't use an

    isset($_SESSION['key'])

    I need something more like

    isset($_SESSION)

    I tried this and found that even if no items were added to order the conditional statemnt would still return true. I have to use the start_session(); at the top of each page and wondered if this was casuing the problem.

    If anyone had any explination of what the problem might be I would be very grateful

    I wondered if it is possible to see if any session data is a member of my product class

    Thanks
    Last edited by timgolding; 11-21-2006 at 03:06 PM.
    You can not say you know how to do something, until you can teach it to someone else.

  • #2
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    This works

    PHP Code:
    $session_data=false;
    foreach(
    $_SESSION as $current_item)
        {
            if (
    is_a($current_item'myclass')) 
                   
    $session_data=true;
        } 
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

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