Connections aren't just a data item that can be remembered and passed from one script execution to another. When you load a PHP powered page through your web server, it starts running the script and occupies a certain section of memory. This memory space also holds pointers to things like database connections. When you dump the values of a connection variable, you may get a connection ID number, but don't mistake that for something you can pass from one script to another.
When the PHP script gets to the end, it exits. Freeing up the memory and resources it was using. Your connection is closed, even if you didn't specifically close it. You can look into setting up a "persistant" connection. I believe that's what you're aiming for. Honestly, I've never looked into the benefits and drawbacks of using persistant connections. I like to keep things clean, and the things I've worked on haven't been so intensive that they suffered from opening a connection per page load. It's good to keep the "connect" commands to a minimum, as they're very system intensive (comparatively) but most times, having one "connect" at the head of your script and closing it at the end of the script execution isn't a big deal. But you won't be able to pass the connection information via session variables. -TG ----- Original Message ----- From: Fred Silsbee <fredsils...@yahoo.com> To: email@example.com Date: Thu, 25 Dec 2008 15:57:13 -0800 (PST) Subject: [PHP-DB] is there any reasone why the following doesn't work? > $connection=oci_connect('landon', 'xxxxxxx',$db) > session_start(); > $_SESSION['connection'] = $connection; > .. > .. > .. > > $connection = $_SESSION['connection'] ; shows nothing! > > My program allows many operations on a table re-entering at the top > and deciding what option to do next. > > I don't want to keep logging into Oracle but use the previous connection -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php