PDA

View Full Version : need some help with a php script !



GregT
August 7th, 2002, 22:15
Ok, im writing a script that will randomally display a logo




<?php
$Data[1] = "button.jpg";
$Data[2] = "m4btn2.jpg";
$Data[3] = "robouk.gif";
$Data[4] = "tf.gif";
$Data[5] = "urbuttonhere.jpg";
$Data[6] = "urbuttonhere.jpg";
$Data[7] = "urbuttonhere.jpg";
$i = rand(1, size of($Data));
floor($i);
echo $Data[$i];

?>



but when excuted i get




Parse error: parse error, unexpected T_STRING in /home/projectlinux/project-linux.org/html/gt/affilates/randomaffilate.php on line 9


What am I doing wrong ?

biggulp
August 8th, 2002, 00:21
find $i = rand(1, size of($Data));
replace
$i = rand(1, count($Data) - 1);

JdS
August 9th, 2002, 13:47
btw there's no space in 'sizeof' ?

hohoho
August 9th, 2002, 15:42
Originally posted by biggulp
find $i = rand(1, size of($Data));
replace
$i = rand(1, count($Data) - 1);
The - 1 is wrong because he started with $data[1] and not $data[0]