Re: PEAR DB and BLOB Fields in MySQL
| From: | Vitaliy N. Kravchenko | Date: | Fri, 14 Mar 2003 18:06:01 +0000 |
| Subject: | Re: PEAR DB and BLOB Fields in MySQL | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-14317@lists.php.net to get a copy of this message | ||
Russell Seymour wrote:
<?php // Include and instantiate classes include_once ("DB.php"); // add some lines here:function show_error($o) { print_r($o); exit(0); } PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "show_error");
$o_DB = DB::Connect ("mysql://DBUSER:DBPASSWD@DBHOST/image"); // Define SQL Statement $s_SQL = "SELECT image, imagetype FROM images_TABLE WHERE id = '8'";^^^ are you shure about quotes?
// Run the query on the database $o_Image = $o_DB -> query ($s_SQL); // Get the binary data from the resultset list ($binary_Image, $content_Type) = $o_Image -> fetchrow(); // Output the data to the browser Header ("Content-type: $content_Type"); echo $binary_Image; ?> Try to see print_r($o_DB), I think you have errors with connection,but if you do not use error handling you can't see errors inside objects.. -- kVn http://php4you.kiev.ua/