coxdabd
November 28, 2010, 1:10pm
1
Hi there, just a quick one, I have various images which can be added by a user. If there are no images at all for the slideshow (containing five images) then display “Hello, no images found” instead.
Doesn’t seem to be working.
Any help appreciated as always.
<?php if ($row['homeban01, homeban02, homeban03, homeban04, homeban05']='') { ?>
<?php if ($row['homeban01']!='') {?><img src="../<?php echo $row['homeban01'] ?>" alt="<?php echo $row['alt1'] ?>" width="625" height="315" /><?php } ?>
<?php if ($row['homeban02']!='') {?><img src="../<?php echo $row['homeban02'] ?>" alt="<?php echo $row['alt2'] ?>" width="625" height="315" /><?php } ?>
<?php if ($row['homeban03']!='') {?><img src="../<?php echo $row['homeban03'] ?>" alt="<?php echo $row['alt3'] ?>" width="625" height="315" /><?php } ?>
<?php if ($row['homeban04']!='') {?><img src="../<?php echo $row['homeban04'] ?>" alt="<?php echo $row['alt4'] ?>" width="625" height="315" /><?php } ?>
<?php if ($row['homeban05']!='') {?><img src="../<?php echo $row['homeban05'] ?>" alt="<?php echo $row['alt5'] ?>" width="625" height="315" /><?php } ?>
<?php }
else {
echo "Hello, no images found.";
}
?>
coxdabd
November 28, 2010, 1:15pm
2
Hello, sorry been a right douch! This is working and is echoing but the font is in white (same as my page background) so couldn’t see it. Sorry for the posting. All sorted now.
coxdabd
November 28, 2010, 1:51pm
3
Hello, ok stuck now. Add if elseif and else statements but now the if statement doesn’y seem to be working. Anyone got any ideas what I have done incorrectly?
<?php if ($row[‘homeban01, homeban02, homeban03, homeban04, homeban05’]!=‘’) { ?>
<?php if ($row[‘homeban01’]!=‘’) {?><img src=“…/<?php echo $row[‘homeban01’] ?>” alt=“<?php echo $row[‘alt1’] ?>” width=“625” height=“315” /><?php } ?>
<?php if ($row[‘homeban02’]!=‘’) {?><img src=“…/<?php echo $row[‘homeban02’] ?>” alt=“<?php echo $row[‘alt2’] ?>” width=“625” height=“315” /><?php } ?>
<?php if ($row[‘homeban03’]!=‘’) {?><img src=“…/<?php echo $row[‘homeban03’] ?>” alt=“<?php echo $row[‘alt3’] ?>” width=“625” height=“315” /><?php } ?>
<?php if ($row[‘homeban04’]!=‘’) {?><img src=“…/<?php echo $row[‘homeban04’] ?>” alt=“<?php echo $row[‘alt4’] ?>” width=“625” height=“315” /><?php } ?>
<?php if ($row[‘homeban05’]!=‘’) {?><img src=“…/<?php echo $row[‘homeban05’] ?>” alt=“<?php echo $row[‘alt5’] ?>” width=“625” height=“315” /><?php } ?>
<?php }
elseif ($row[‘singleImg’]!=‘’) { ?>
<img src=“…/<?php echo $row[‘singleImg’] ?>” width=“625” height=“315” />
<?php }
else {
echo ‘<span style="color:#FFFFFF ">Hello, no images found.’;
}?>
Immerse
November 28, 2010, 2:01pm
4
This is wrong:
$row['homeban01, homeban02, homeban03, homeban04, homeban05']
You can’t stick them all together like that, it should be:
if($row['homeban01']!='' || $row['homeban02']!='' || $row['homeban03']!='' || $row['homeban04']!='' || $row['homeban05']!='') {
That should work better
coxdabd
November 28, 2010, 2:08pm
5
Hi Immerse, aww, I see. I was nearly there just made a bit of a hash with that. Ok, thank you, all working perfectly now. Thanks for your help and speedy reply. Have a good afternoon over there!