PLz Help
i have some Images in DataBase in Blob field
but images are displayed with a Cross (X) not the actual image

MainPage.php//code

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
   die('Could not connect: ' . mysql_error());
mysql_select_db("db1", $con);
$image = mysql_query("SELECT * FROM userimagetable");
while($imageResult = mysql_fetch_array($image) ){
	?>
	<img src="ViewImage.php?id=<?=$imageResult['id']?>" alt="Picture" /></td></tr>
	<?php 
}

and the other file displaying image code is

ViewImage.php

<?php
$id = $_GET['id'];
$image = mysql_query("SELECT * FROM userimagetable WHERE Id='".$id."'");
$imageResult = mysql_fetch_array($image);
	header("Content-type: image/jpg");
echo $imageResult['UserImage'];
?>

plz help me

hi this is nathen,

try this in your code everything is same except $image = mysql_query("SELECT * FROM userimagetable WHERE Id=".$id); And also no need to use of header line you cna remove header("Content-type: image/jpg");so finally you code is

<?php
      $id = $_GET['id'];
      $image = mysql_query("SELECT * FROM userimagetable WHERE Id=".$id);
      $imageResult = mysql_fetch_array($image);
         echo $imageResult['UserImage'];
      ?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.