Hi there!
Is it possible to save classes (objects) into a database in PHP? What fieldtype
should be used then (MySQL) ?
Best regards
/Gustav Wiberg
Hi there,
You would use a blob or text field.
You will have to serialize the object before saving it to db.
Then when you retrieve it, you will have to deserialize it and then eval()
the object so as to active all the values.
-Original Message-
From: Gustav Wiberg [mailto:[EMAIL PROTECT
Hi there!
Ok, thanx! I'll try this...
Best regards
/Gustav Wiberg
-Original Message-
From: Dale Attree [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 3:12 PM
To: 'Gustav Wiberg'; ''php windows''
Subject: RE: [PHP-WIN] Save classes to db?
Hi there,
You would use a blob or tex
Hi again!
Can't I use unserialize?
/Gustav
-Original Message-
From: Dale Attree [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 3:12 PM
To: 'Gustav Wiberg'; ''php windows''
Subject: RE: [PHP-WIN] Save classes to db?
Hi there,
You would use a blob or text field.
You will have
Dale Attree wrote:
Hi there,
You would use a blob or text field.
You will have to serialize the object before saving it to db.
Then when you retrieve it, you will have to deserialize it and then eval()
the object so as to active all the values.
It's unserialize not deserialize, and there's n
Hi!
Wouldn't it be possible to serialize the object in destructor of the class and
unserialize from the constructor?
Best regards
/Gustav Wiberg
-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 3:29 PM
To: Dale Attree
Cc: 'Gustav Wiberg'; ''php win
Gustav Wiberg wrote:
Wouldn't it be possible to serialize the object in destructor of the class and
unserialize from the constructor?
As in serialize($this)?? Think about it for a while and you'll see why
that's not really a great idea.
Firstly, where do you store the serialized object?
Se
Hi!
Ok, thanx!
Best regards
/Gustav Wiberg
-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 3:42 PM
To: Gustav Wiberg
Cc: 'Dale Attree'; ''php windows''
Subject: Re: [PHP-WIN] Save classes to db?
Gustav Wiberg wrote:
> Wouldn't it be possible to se
Hi again!
I really can't find a manual for __sleep on the php.net site!? But I understand
that __sleep is called before serialize and __wakeup is called before
unserialize?
Do you mean that I create a function __sleep in my class where I serialize my
object and create a function __wakeup in my
http://www.php.net/manual/en/language.oop5.magic.php
Gustav Wiberg wrote:
Hi again!
I really can't find a manual for __sleep on the php.net site!? But I understand
that __sleep is called before serialize and __wakeup is called before
unserialize?
Do you mean that I create a function __sleep
Hi!
Thanx!
/Gustav
-Original Message-
From: M. Sokolewicz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 4:27 PM
To: Gustav Wiberg
Cc: 'Stut'; 'Dale Attree'; ''php windows''
Subject: Re: [PHP-WIN] Save classes to db?
http://www.php.net/manual/en/language.oop5.magic.php
Gusta
Gustav Wiberg wrote:
Hi again!
I really can't find a manual for __sleep on the php.net site!? But I understand
that __sleep is called before serialize and __wakeup is called before
unserialize?
My bad, it's __wakeup not __wake. But still, a quick search of php.net
for __sleep found this...
Hi again!
I apologize for typing _wake (I meant __wakeup)
I search for __sleep on the php.net - site, but I also search for functions..
When I did that I came to function "sleep" which is a totally diffrent thing...
Thanx for making clearer! Now I think I get it!
Thanx a lot!
Best regards
/
13 matches
Mail list logo