Snippet >> PHPAffili8 >> Random Affiliate

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

Leave a Reply

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif 

CommentLuv badge