Home  |  Linux  | Mysql  | PHP  | XML
From:Uri Guttman Date:Wed Aug 28 21:40:05 2002
Subject:Re: blobs
>>>>> "IT" == Iain Truskett <perl@dellah.anu.edu.au> writes:

  IT> How does one actually go about inserting and retrieving binary data from
  IT> a database?

  IT> {
  IT> my $sth = $dbh->prepare('insert into covers (isbn,small) values (?,?)');
  IT> $sth->execute($isbn, $imagedata);
  IT> }

  IT> Because that's not working for me.

no, you must convert it first to a string by using storable (freeze
method) or some other module. then you can insert it into a long field
of type BLOB.

when you read it from the DB you do the conversion from text to binary
(thaw method) and assign it to your variable. make this image access a
cgi/url for the IMG tag and it should work fine.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Navigate in group perl.books.workers at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants