This snippet will take a random affiliate in your PHPAffili8 and shows it where ever you place the include. Want to see what it looks like? Then just look down the right side bar of my layout. You’ll see a header that says Random Affiliate and that is it!
<? $linkcount = 1;
include(“config.php”);
$result=mysql_query (“SELECT * FROM $table ORDER BY RAND() LIMIT $linkcount”);
if ($row=mysql_fetch_array($result)) {
do {
$width=$row["width"];
$height=$row["height"];
if ($width < 10){
$insert_width = “”;
} else { $insert_width=” width=\”$width\”"; }
if ($height < 10){
$insert_height = “”;
} else { $insert_height=” height=\”$height\”"; }
?>
<a href=”<?=$row["url"]?>” target=”_blank”><img border=”0″ src=”<?=$imageurl?><?=$row["filename"]?>” alt=”<?=$row["title"]?>” title=”<?=$row["title"]?>”<?=$insert_width?><?=$insert_height?>></a>
<?
} while($row = mysql_fetch_array($result));
} else {print “There are no affiliates.”;}
?>
You load this file into your affiliates directory, or whatever you have named the folder that contains all of the files for phpaffili8.
Finally, you put this include wherever you want the random affiliate to show up (note that you must know your path):
<? include (“/path/to/your/phpaffili8/random.php”) ?>
Page Views: 14 views



















