Hi there I am storing images in my db as long blobs and have successfully managed to display them for each record using this bit of code...
<img src="GetImage.
php?ID=<?
php echo $row_Recordset1['ID']; ?>"
which creates a separate request from the GetImage.
php page for each record in db...
Trouble is I would like to display a default image if there is no image in the db for that record...
I realise this must be done in the GetImage.
php page but I am not sure what to check for or what value to send as my default image since the blob is binary?
Here is my code for GetImage.
php...
if($_GET['ID'])
{
mysql_select_db($database_The_DB, $The_DB);
$query_Recordset1 = sprintf("SELECT ID, Picture, ImageType FROM User_Details WHERE ID = '%s'",$_GET["ID"]);
$Recordset1 = mysql_query($query_Recordset1, $The_DB) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
//echo $query_Recordset1, $totalRows_Recordset1;
$data = mysql_result($Recordset1,0,"Picture");
$type = mysql_result($Recordset1,0,"ImageType");
//if ($data = "")
//$data = /Images/Home_Graphic.jpg
//$type = image/jpg
header("Content-type: $type");
echo $data;
}
?>
i would really appreciate any help on this.
Thanks in advance
Brian