OK. I finally understand. When I want to save an object across client
requests, I need to serialize() that object into a session variable and when
I need to use it later I need to unserialize() it into a local variable. If
I modify the object, I need to replace the serialized session variable.
I
Stan wrote:
I don't understand the process. When session_start() reconnects to a (the)
session, objects saved as $_SESSION variables must be "recreated". To do
this requires the class definition. So the class definition must be loaded
prior to calling session_start().
Some other languages I
I don't understand the process. When session_start() reconnects to a (the)
session, objects saved as $_SESSION variables must be "recreated". To do
this requires the class definition. So the class definition must be loaded
prior to calling session_start().
Some other languages I've written in
> -Original Message-
> From: Nehemias Duarte [mailto:ndua...@aflac.com]
> Sent: 11 November 2009 14:25
> To: Stan; php-db@lists.php.net
> Subject: RE: [PHP-DB] losing MySQL resource
>
> I was under the impression that session_start() had to be the FIRST
> thing ra
I was under the impression that session_start() had to be the FIRST
thing ran in the script. Is this incorrect?
>>OK. The secret, as has been stated here before, is to load the class
definitions BEFORE calling session_start(). Thanks to everyone.
""Andy Shellam (Mailing Lists)"" wrote in
mess
OK. The secret, as has been stated here before, is to load the class
definitions BEFORE calling session_start(). Thanks to everyone.
""Andy Shellam (Mailing Lists)"" wrote in
message news:3339c510-be08-4426-9265-ba1965a9a...@networkmail.eu...
> Hi Stan,
>
> Are you saving the instance of your c
Hi Stan,
Are you saving the instance of your class in $_SESSION?
Class instances can be persisted across sessions, however resources
(i.e. MySQL and other DB connections) cannot. What you need to do, is
every method in your wrapper class that uses the MySQL resource needs
to check if it's
I got as far as creating a class to be the wrapper ... instantiating an
object of that class ... saving the reference in a $_SESSION variable ...
but my object reference seems to be invalid upon the next request (in the
same session) from the client browser. What have I missed?
Thanks,
Stan
""An
Hi,
I got around this by creating a database wrapper class which gets
passed the credentials from the app's config file. An instance of the
class is created and saved in the session, and every query to the
database runs through the class's Query() wrapper method which checks
if the conne
How do I make an Object persistant for the duration of a Session?
Thanks,
"Chris" wrote in message news:4ab6b16...@gmail.com...
> Niel Archer wrote:
> >> I'm maintaining a session. I successfully connect to a database
($DBConnect
> >> = mysql_connect()). I save the connection resource in a sessi
Niel Archer wrote:
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 pag
Thanks.
"Niel Archer" wrote in message
news:20090919121842.b95b.a5cb2...@chance.now...
> > 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 u
> 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(
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[
14 matches
Mail list logo