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 no need to eval anything,
just make sure you have either included the class definition before
unserializing it or have an __autoload function defined.
Remember that you cannot serialize resources, so you must make sure you
close any open resources in the __sleep method, and you can recreate
them during unserialize using a __wake method.
-Stut
--
http://stut.net/
-----Original Message-----
From: Gustav Wiberg [mailto:gustav@xxxxxx]
Sent: 26 June 2007 02:28 PM
To: 'php windows' (php-windows@xxxxxxxxxxxxx)
Subject: Save classes to db?
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
This e-mail may contain confidential information belonging to the sender which is legally privileged. It is the responsibility of the recipient to ensure that any e-mails or attachments are virus free as Jacklin Enterprises accepts no responsibility. Should you not be the intended recipient then any disclosure, copying, distribution or the taking of any action in reliance of the contents of this email is strictly prohibited. If you have received this transmission in error, please notify the sender immediately.
Jacklin Enterprises Limited is registered in England No. 4398837
Registered office: 18 Bentinck Street, London, W1U 2AR. VAT Registration No: 831 0256 68
This email has been scanned by the MessageLabs Email Security System.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php