|
Posted by Zareef Ahmed on 03/15/05 05:52
On Mon, 14 Mar 2005 12:11:40 -0800, Robby Russell <robby@planetargon.com> wrote:
> On Mon, 2005-03-14 at 14:07 -0600, Chris Boget wrote:
> > 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
> >
>
> Try serializing it first.
>
> What happens when you run:
>
> echo $this;
>
> ..your query is going to save the same thing.
>
> try serialize($this) instead.
and do not forgot to unserialize($fieldvalue) ;)
zareef ahmed
>
> -Robby
>
> --
> /***************************************
> * Robby Russell | Owner.Developer.Geek
> * PLANET ARGON | www.planetargon.com
> * Portland, OR | robby@planetargon.com
> * 503.351.4730 | blog.planetargon.com
> * PHP, Ruby, and PostgreSQL Development
> * http://www.robbyonrails.com/
> ****************************************/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net
Navigation:
[Reply to this message]
|