$query = "SELECT random1 FROM random_number";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
$rand="{$row['random1']}";
}
$image = "";
$broad_img1= "";
$path= 'http://www.acmeart.co.uk/mercury/';
$web_image_folder = 'image/thumbs';
$exts = array('jpg', 'png', 'gif', 'jpeg');
$image_name = 'thumb_image1';
// check for each extension
foreach($exts as $ext) {
if (file_exists($web_image_folder.'/'.$image_name.'.'.$ext . $rand)) {
$image = $image_name.'.'.$ext . $rand;
}
}
// check if we have an image
if ($image != "") {
// ok we have the image
$broad_img1='<img src="' . $path."/".$web_image_folder."/".$image . $rand'" />';
} else {
// error, we can't find the image.
}
the image will not display, will the $rand variable still hold the value set from the mysql query.