This is probably a FAQ, but the on-line manual is rather confusing 
and I can't get it to work!

The problem:  I have a fairly complicated set of objects, all 
interconnected through the instance variables of one object storing 
the value of another and so on.  Other instance variables hold 
strings.  I want to store the whole thing in a PostgreSQL database 
and then later recreate the entire hierarchy with everything set up 
as before.

This is what I am using ($zurich is an instance of the Class Zurich):

    $s = addslashes(serialize $zurich));
    $result = pg_exec($db, "UPDATE zurtable SET serializedobject = '$s'
                                       WHERE name='Zurich'");
    [error checking omitted]

This puts something sensible into the database; the first few 
characters of what is retrieved using the database front end psql 
looks like this:


             [many lines omitted]

9 Aug 2001 17:08:55 +0100\";}

However, when I come to extract the field from the database using:

$result = pg_exec($db, "SELECT serializedobject FROM zurtable WHERE
$row = pg_fetch_array($result,0);
$new_s = $row['serializedobject'];

the output ($new_s) is null.  What am I doing wrong?

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to