RE: [PHP-DB] How to I fetch an image file from /tmp directory?

From: Date: Sun, 29 Jul 2001 19:10:38 +0000
Subject: RE: [PHP-DB] How to I fetch an image file from /tmp directory?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10878@lists.php.net to get a copy of this message
Don't you still have to do mysql_fetch_array()? Because $get=mysql_query(....) is just a pointer to the mysql_query, right? To grab the data you'd need to do something like this: <?php $sql = "SELECT bin_data FROM binary_data WHERE (id = '$id')"; $get = mysql_query($sql); $row = mysql_fetch_array($result); header("Content-type: image/jpeg"); echo $row["bin_data"]; ?> Of course, this is speculation, I never have done any binary data from MySQL stuff before, but this is what it SEEMS like you should do...change the Content-type to a gif if its gif data, png if its png data... -- David Balatero -----Original Message----- From: Mark Gordon [mailto:eyesyte@yahoo.com] Sent: Sunday, July 29, 2001 11:53 AM To: php-db@lists.php.net Subject: [PHP-DB] How to I fetch an image file from /tmp directory? I am inserting binary image data into a mysql table (mediumblob). Actually, what goes into the table is the /tmp... pathname. This is the code I used to try to retrieve, but I get "Resource ID#2" $get=mysql_query("SELECT bin_data FROM binary_data WHERE id=$id"); print"<img src=$get>"; ===== Mark eyesyte@yahoo.com __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#10878) next »