queerfm
03-20-2008, 12:57 PM
Hi i would like to show a random ad based on keyword.
For e.g i have 3 technology ads and i would like the PHP to randomly choose a ad to show this is what i have.
<?php
$ads = "SELECT * FROM ads ORDER BY RAND()LIMIT 1";
$adsresult = mysql_query($ads);
while($row = mysql_fetch_array($adsresult)) echo"{$row['file']}&displaywidth={$row['displaywidth']}&displayheight={$row['displayheight']}";?>
This script does work but it just randomly chooses the ad to show.
Thanks
For e.g i have 3 technology ads and i would like the PHP to randomly choose a ad to show this is what i have.
<?php
$ads = "SELECT * FROM ads ORDER BY RAND()LIMIT 1";
$adsresult = mysql_query($ads);
while($row = mysql_fetch_array($adsresult)) echo"{$row['file']}&displaywidth={$row['displaywidth']}&displayheight={$row['displayheight']}";?>
This script does work but it just randomly chooses the ad to show.
Thanks