having problem with session

Discussion in 'PHP' started by chintito, Sep 1, 2007.

  1. #1
    hi all,
    I am new in php. I am facing a problem with session. I create a session in a script named "index.php". This script call another php file "session.php". when i work in "session.php" it doesn't recognize the session in "index.php". what should i do to make the session available in "seesion.php" that is created in "index.php".
    thanx
     
    chintito, Sep 1, 2007 IP
  2. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    does the session start before the other page is called? or after
     
    Dirty-Rockstar, Sep 1, 2007 IP
  3. wigwambam

    wigwambam Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ensure the following line is at the top of each page:

    session_start();
     
    wigwambam, Sep 1, 2007 IP
  4. chintito

    chintito Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    session_start() is placed before every script. But when a new script is called the previous session is replaced by the new one. I want to use the older session. what to do?
     
    chintito, Sep 1, 2007 IP
  5. James.Blant

    James.Blant Active Member

    Messages:
    250
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #5
    i think(i'm not sure ) you should place session_start() directly on page and other session codes and you can't include or require that .
     
    James.Blant, Sep 2, 2007 IP
  6. wigwambam

    wigwambam Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Not sure then, could be the way PHP is configured?

    Write a page with this code:

    <?php phpinfo();?>

    Can you provide a link to results so I can compare with mine?
     
    wigwambam, Sep 2, 2007 IP
  7. alarik

    alarik Active Member

    Messages:
    382
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #7
    I had the same fuc*in problem with php...just drivo me crazy and I started using cookies :)
     
    alarik, Sep 2, 2007 IP