Be a Supporter!

php:main query

  • 330 Views
  • 3 Replies
New Topic Respond to this Topic
onlyproductions
onlyproductions
  • Member since: Oct. 30, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
php:main query 2006-12-03 21:22:21 Reply

in the random ad script in the php main the image does appear randomly but no link is attached to the image how can i fix this


.

BBS Signature
WoogieNoogie
WoogieNoogie
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 15
Programmer
Response to php:main query 2006-12-03 21:29:38 Reply

I'd need to see the code you're using to help.

onlyproductions
onlyproductions
  • Member since: Oct. 30, 2005
  • Offline.
Forum Stats
Member
Level 11
Blank Slate
Response to php:main query 2006-12-03 21:32:52 Reply

k heres my code
<?php
$ads = array("http://www.bomtoons.com/downloads/bann ers/banner2.gif", "http://www.newgrounds.com/banners/BadReligio nSkater_2.gif");
$links = array("http://www.bomtoons.com", "http://www.newgrounds.com");
$total_ads = count($ads);
$pick_ad = rand(0, $total_ads-1);
echo '<img src="' . $ads[$pick_ad] . '">';
?>


.

BBS Signature
WoogieNoogie
WoogieNoogie
  • Member since: Jun. 26, 2005
  • Offline.
Forum Stats
Member
Level 15
Programmer
Response to php:main query 2006-12-03 21:51:35 Reply

<?php
$ads = array("http://www.bomtoons.com/downloads/bann ers/banner2.gif", "http://www.newgrounds.com/banners/BadReligio nSkater_2.gif");
$links = array("http://www.bomtoons.com", "http://www.newgrounds.com");
$total_ads = count($ads);
$pick_ad = rand(0, $total_ads-1);
echo '<a href="' . $links[$pick_ad] . '"><img src="' . $ads[$pick_ad] . '"></a>';
?>

That should work with your current syntax.