Click to See Complete Forum and Search --> : php random banner changing


stu
12-30-2002, 02:05 AM
I have been having a few problems with creating a script that will work properly to display a few different banners. Here are the 2 different scripts I have been using:
--1).--
<?php
$Data[1] = "file1.jpg";
$Data[2] = "file2.jpg";
$Data[3] = "file3.jpg";
$i = rand(1, sizeof($Data));
floor($i);
echo $Data[$i]
?>

--2).--
<?php
$Data[0] = "red.jpg";
$Data[1] = "blue.jpg";
$Data[2] = "green.jpg";
$rand_key = date("s") % sizeof($Data);

echo $Data[$rand_key];
?>

They both work in the sense that I get a random name in the array's but I do not actually display that specific file. I have tried taking off the "'s but that obviously didn't help. Tried putting teh path name to the directory but that was no help either. Any suggestions?

stu
12-30-2002, 02:30 AM
Please pardon my stupidity:)
I just added some html tags in there.