anyone has anything like that
just want to rotate different banners on page, anyone have any simple php script to do that?
thanks
just want to rotate different banners on page, anyone have any simple php script to do that?
thanks
<?
// Change the banner/URL mappings as you so desire.
$b = array(
'banner1.jpg' => 'http://target.url1',
'banner2.jpg' => 'http://target.url2',
'banner3.jpg' => 'http://target.url3'
);
// If you'd rather use mysql:
// $q = mysql_query("select img, url from whatever_table order by rand() limit 1");
// $r = mysql_fetch_assoc($q);
// $img = $r[img]; $url = $r[url];
$img = array_rand($b); // The easy way to pull a random element from an array ;)
$url = $b[$img];
print "<A HREF='$url'><IMG SRC='$img' BORDER=0></A>";
?>


Comment