displaying pictures form db [problem]

From: Date: Sun, 11 Mar 2001 22:06:06 +0000
Subject: displaying pictures form db [problem]
Groups: php.general 
Request: Send a blank email to php-general+get-43411@lists.php.net to get a copy of this message
Im trying to display the picture from the database, but I cant get it to work. That`s just a short version of your script. I try to display the picture like that: <img src='showpic.php' width='150' height='80'> and showpic looks like this: <?php $query = "select file_data,file_type, from pildid where id=1"; $result = @MYSQL_QUERY($query); $data = @MYSQL_RESULT($result,0, "file_data"); $type = @MYSQL_RESULT($result,0, "file_type"); Header( "Content-type: $type"); $picture = $data; print $picture; ?> Any ideas why it might not work as expected? I have written picture to the db, but ...? I write them like: $main = addslashes(fread(fopen($main_pic, "r"), filesize($main_pic))); $sql -> insert("pildid","section,productid,picnr,file_name,file_type,file_data","'$section','$productid',0,'$main_pic_name','$main_pic_type','$main'"); Thanks in advance; Siim EInfeldt

« previous php.general (#43411) next »