CodeInit

text link rotator script

View PDF
by: Admin
Total views: 589

If your links are stored in a database table, you can use rand() to select a random list of links. In that table you have the columns "id", "text" and "url".
Here's your query for returning 5 rows:

$query="select * from YOUR_TABLE order by rand() limit 5";
$res=mysql_query($query);
$links='';
while($row=mysql_fetch_array($res)){

$links.='<a href="'.$row['url'].'">'.$row['text'].'</a><br />';

}


All you have to do now is echo $links; wherever on the page you want on your list of links.

About the Author


Rating: Not yet rated

Comments

No comments posted.

Add Comment