seran128 Posted November 24, 2006 Share Posted November 24, 2006 I am storing images in mysql (don't ask its a client request) I can see the images in Navicat as images but when I go to get it out with a select statement I get garbage.my code[code]function getpicturecontent($inId){ global $connection; $sql="select * from images where ItemId='$inId'"; echo $sql; $result=mysql_query($sql,$connection) or die(mysql_error()); while($row=mysql_fetch_array($result)) { $getpicturecontent .= "<table width='200' border='0'> <tr> <td>" . $row['content'] . "</td> </tr> <tr> <td></td> </tr> </table>";}return $getpicturecontent;} [/code] This returns a bunch of characters. I know there is a header call I have to do but I cant find it. Link to comment https://forums.phpfreaks.com/topic/28316-viewing-images-in-a-mysql-db/ Share on other sites More sharing options...
fert Posted November 24, 2006 Share Posted November 24, 2006 [code]header("Content-type: image/image type");[/code] Link to comment https://forums.phpfreaks.com/topic/28316-viewing-images-in-a-mysql-db/#findComment-129501 Share on other sites More sharing options...
seran128 Posted November 24, 2006 Author Share Posted November 24, 2006 Where do I place that code at? Link to comment https://forums.phpfreaks.com/topic/28316-viewing-images-in-a-mysql-db/#findComment-129506 Share on other sites More sharing options...
JasonLewis Posted November 24, 2006 Share Posted November 24, 2006 at the top of the page, change the image type in that header to the type of image, jpeg etc... Link to comment https://forums.phpfreaks.com/topic/28316-viewing-images-in-a-mysql-db/#findComment-129507 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.