|
Posted by "Mike" on 12/16/05 06:35
Hi,
I'm still very green with PHP, but am working to fix that.
I've searched high and low for an answer to this question and so far
no solution has presented itself. I have a script to populate my web page
with random images:
<?php
#random images example
#this is your file
$file = "images.txt";
#open the file
$openFile = file($file);
#generate a random number
srand((double)microtime()*1000000);
#get one of the entries in the file
$random_image = $openFile[array_rand($openFile)];
#display the entry
echo "<img src='$random_image' height='170' width='100'></img>";
?>
This works beautifully, but my problem is that sometimes, the same image
displays twice or more on the same page-load. My page requires 10 different
places where my images need to load, but I can't have any duplicate images
show up.
Any suggestions on what I need to modify here?
Thanks in advance!
Mike
Navigation:
[Reply to this message]
|