I'm using a PHP script which gets data from a text file and displays three random images in a php page. The problem I'm having is that three images don't always show on the page :/ When refreshing the page to see the new random images, sometimes only 1 image will display, sometimes only 2, and then sometimes three. I want three random images to display always. Does anyone have any ideas what I could add to make sure three images always display? :S
php:
<?php
$random = "random.txt";
$fp = file($random);
shuffle($fp);
$keys = array_rand($fp, 3);
for ($i = 0; $i < 3; $i++):
$rl = $fp[$keys[$i]];
echo $rl;
endfor;
?>
html:
<div class="imagecontainer">
<?php include('rotate.php') ?>
</div>