Problem retrieving/updating data from InterBase
| From: | Vincent Verhoeven | Date: | Wed, 19 Mar 2003 07:20:13 +0000 |
| Subject: | Problem retrieving/updating data from InterBase | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26466@lists.php.net to get a copy of this message | ||
Hi,
currently I'm working with an Interbase 6.0 database and I want to insert
some text (and eventually a picture) to a blob field. I've found the
following php code:
$bid = ibase_blob_create();
ibase_blob_add($bid, "test");
$comments_blob = ibase_blob_close($bid);
$sql = "UPDATE tblcontent SET Metadata=? WHERE id=1";
ibase_query($sql,$comments_blob);
ibase_commit();
When I try to retrieve this blobdata, I use the following code:
$set = ibase_query("SELECT Metadata FROM tblcontent WHERE ID = 1");
$row = ibase_fetch_object($set);
$blob_id = ibase_blob_open($row->Metadata);
$content = ibase_blob_get($blob_id);
ibase_blob_close($blob_id);
ibase_free_result($set);
$content returns an empty string.
I don't know if it goes wrong updating the data, or retrieving the data.
Can anybody help me out here....
Thanks in advance....
Vincent