display certain number of banners
Posted: Mon May 20, 2013 11:49 am
Hey everyone its been a while but I am in a bind.
I am developing a script and a feature in the script is to display banners and with that the admin can choose how many spots are for banners
Lets say they enter 5
and in the table there is 4 so that leaves 1 spot available
so what I need to do is display the 4 and then that 5th spot I need to display a default banner
Here is what I have so far
I am developing a script and a feature in the script is to display banners and with that the admin can choose how many spots are for banners
Lets say they enter 5
and in the table there is 4 so that leaves 1 spot available
so what I need to do is display the 4 and then that 5th spot I need to display a default banner
Here is what I have so far
Code: Select all
<?php $r = mysql_query("SELECT * FROM announcement_banners") or die(mysql_error());
if(@mysql_num_rows($r) == 0) {
echo'<img src=../images/'.$pop['defaultbanner'].'>';
} else {
while($row = mysql_fetch_array($r, MYSQL_ASSOC)) {
echo'<a href='.$row['link_url'].'><img src='.$row['banner_url'].'></a></br>
</br>';
}
}
?>
now as you see I have it telling it that if its 0 to show the default banner and I know this will need to change but not sure how to code it/word it to make it do what I need as stated above.
any help would be great