View Single Post
  #1 (permalink)  
Old 06-10-03, 12:52 PM
doogi doogi is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
random link problem

Hi there
it's my first thread here so first i'd like to say hello to everyone

i have pictures with links to other sites on my page. After each reloading script shows 5 random pics with links.
I have 3 tables with 5 pics on my so 15 pics is used at one time. i have a 45 pics in a txt file which can be teken by script.
My problem is that i have 2 or even 3 same pics after each reloading. what can i do to have no doubled pics?
the scripts looks like below:
<?
$ile = 5;
$file = file("pics.txt");
echo "<table width=\"600\"><tr>";
for($i=0;$i<$ile;$i++)
{
srand((double)microtime()*1000000);
$link = $file[array_rand($file)];
$sp = explode("||", $link);
if($sp[0]<>"")
{
echo "<td align=middle><a
href=\"".$sp[2]."\"><img src=\"".$sp[0]."\" border=3></a><br><font
style=\"font-weight: bold; font-size: 11px; font-family: Tahoma\">".$sp[1]."<br></font></td>";
}
}
echo "</tr></table>";
?>

Help me pls
doogi
Reply With Quote