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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts

    Question session_register help plz.

    PHP Code:
    session_start();

    if (!isset(
    $_SESSION['pears'])) {
        echo 
    "pears were not set";
        
    session_register ("pears");
        
    $pears dmondindex("pear");
    }

    if (!isset(
    $_SESSION['pears'])) {
        echo 
    "rounds were not set";
        
    session_register ("rounds");
        
    $rounds dmondindex("round");

    dmondindex is a fairly lengthy parsing function that only needs to be done once per session. the above code doesn't seem to set the session variables properly because every time i refresh my browser i get the echo messages, instead of just the first time around

    thanks,
    Leon

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    256
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It looks like register_globals might be turned off on your server (this has been the default setting since PHP 4.2.0, and it is removed altogether in version 6).

    You should instead use the $_SESSION array:
    http://uk.php.net/manual/en/reserved...iables.session

  • #3
    Regular Coder
    Join Date
    Apr 2006
    Location
    Northbrook, IL
    Posts
    394
    Thanks
    8
    Thanked 6 Times in 6 Posts
    yep already solved. thanks.

    PHP Code:
    session_start();

    if (!isset(
    $_SESSION['pears'])) {
        
    $_SESSION['pears'] = dmondindex("pear");
    }

    if (!isset(
    $_SESSION['rounds'])) {
        
    $_SESSION['rounds'] = dmondindex("round");
    }

    $pears $_SESSION['pears'];
    $rounds $_SESSION['rounds']; 


  •  

    Posting Permissions

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