Re: losing MySQL resource

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

 



Thanks.

"Niel Archer" <not@xxxxxxxxxx> wrote in message
news:20090919121842.B95B.A5CB2C2A@xxxxxxxxxxxxx
> > I'm maintaining a session.  I successfully connect to a database
($DBConnect
> > = mysql_connect()).  I save the connection resource in a session
variable
> > ($_SESSION['connection'] = $DBConnect) ... to use in subsequent queries.
It
> > remains valid while the user is on the current page.
> > print_r($_SESSION['connection']) yields 'Resource id #3', for instance.
> >
> > User browses to a new page ... in the same session.
$_SESSION['$DBConnect']
> > no longer references a valid mysql resource.
> > print_r($_SESSION['connection']) yields '0'.
> >
> > Other "ordinary" values saved in $_SESSION variables remain valid.
> >
> > Is there something special about a mysql resource?
>
> Not about the resource itself, no. PHP closes connections to a Db when a
> script ends, unless the connection is persistent, so while the resource
> IS saved, the connection to which it refers no longer exists.
>
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> --
> Niel Archer
> niel.archer (at) blueyonder.co.uk
>
>



-- 
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