Re: is there any reasone why the following doesn't work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- On Thu, 12/25/08, Fred Silsbee <fredsilsbee@xxxxxxxxx> wrote:

> From: Fred Silsbee <fredsilsbee@xxxxxxxxx>
> Subject: is there any reasone why the following doesn't work?
> To: php-db@xxxxxxxxxxxxx
> Date: Thursday, December 25, 2008, 11:57 PM
> $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
_____________________________________
answer? when the php code exits, it must detach the connection and even zero the variable $connection in the _SESSION.

Problem is that my complete program never exits!

What constitutes an "exit"

Running this over and over the $connection is not remembered!

<?php
session_start();
$connection = $_SESSION['connection'] ;
$conn = $_SESSION['conn'] ;
print($conn);
$db = "(DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SID = LMKIIIGDNSID)
   )
 )";
if(!$connection)
{
echo "OOOPS! NO connection, better make one .................";
        if ($connection=oci_connect('landon', 'xxxxx',$db))
        {
                 echo "Successfully connected to Oracle.\n";
                        $_SESSION['connection'] = $connection;
        }
        else
        {
                 $err = OCIError();
         echo "Oracle Connect Error " . $err['message'];
        }
}
else
{

print ("conn0 = ".$connection."   ");
}

print ("conn0 = ".$connection."   ");
$conn = 5.6;
 $_SESSION['conn']= $conn;     //this doesn't perish
?>





      


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux