Hi, another newbie question for the expert programmers out there.
I have some code which generates an image from a BLOB in MySql.
<?php
include('db_login.php');
mysql_connect($db_host, $db_username, $db_password) or die("Can not connect to database: ".mysql_error());
mysql_select_db($db_database) or die("Can not select the database: ".mysql_error());
$id = $_GET['id'];
if(!isset($id) || empty($id)){
die("Please select your image!");
}
else
{
$query = mysql_query("SELECT image_3 FROM in_memorial WHERE record_num='{$id}'");
$image = mysql_result($query,0,"image_3");
if ($image = 'http://www.prrr.org/memorial_wall/image3.php?id=1') {
}
else {
$content = $image;
header("Content-type: image/jpeg");
echo $content;
}
exit();
}
?>
This is called from the following code
while($row = mysql_fetch_row($result)) {
echo('
<title>Memorial for '.$row[1].'</title>
<link href="css/memorial.css" rel="stylesheet" type="text/css" />
<h1 align="center">'.$row[1].'</h1>
<div class="main" id="main"></div>
<div class="pic_div" id="pic_div_1">
<img src="image1.php?id='.$row[0].'" align="left" style="border:thick #000 solid">
<img src="image2.php?id='.$row[0].'" align="right" style="border:thick #000 solid">
</div>
<div class="memorial" id="memorial">
'.$row[5].'
</div>
<div class="pic_div" id="pic_div_2">
<img src="image3.php?id='.$row[0].'">
</div>
');
What I want to do is that if image1.php or image2.php or image3.php do not find an image in the database, they do not display a broken link or an ALT but they skip the display code altogether.
Something like if image3.php?id='.$row[0].' = NULL, display nothing else <img src=image3.php?id='.....................
Hope that makes sense.
Thanks
Q