CodeIgniter Forums
diplaying blob image from mysqli using php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: diplaying blob image from mysqli using php (/showthread.php?tid=52959)



diplaying blob image from mysqli using php - El Forum - 07-03-2012

[eluser]Unknown[/eluser]
hi friends i am using this php code to retrieve image which is stored as blob file in my database
Code:
$dbc=mysqli_connect('localhost','root','','db')

$query="SELECT Binfile, Filetype FROM imagetable where imgid='$imgid'" ;
$result=mysqli_query($dbc,$query);
$row=mysqli_fetch_assoc($result);

$image=$row['Binfile'];
header("Content-type:".$row['Filetype']);

echo $image;
this is the code which i am using to display the image.
But it is giving an error like

The image "http://lacalhost//viewimage.php?imgid=1" cannot be displayed because tit contain errors.


help me to remove this error and display the image...