Class/object storing itself in a database
| From: | Chris Boget | Date: | Mon, 14 Mar 2005 20:07:10 +0000 |
| Subject: | Class/object storing itself in a database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-210690@lists.php.net to get a copy of this message | ||
I have the following Class:
class MyClass {
function store_myself() {
$query = 'INSERT INTO mytable ( myfield ) VALUES ( ' . $this . ')';
$result = mssql_query( $query );
}
}
which works. Kind of. What I expected was a serialized copy of the
object to be stored in the column myfield. However, what I am actually
seeing is simply the word 'Object'.
How can I get it so that the serialize copy is stored so that I can retrieve
that copy later and use it as a PHP object?
thnx,
Chris