Hi, just going to give you a quick overview. I'm a php newbie, and am creating a script do display n# of random unique images from a directory. Below you will find my script, and the error message I get. I am almost positive that it is the images array that I created, as I am uncertain on exactly how to deal with the variable length (since I want to be able to only change $imagetotal if I want to display more images in the future).
Parse error: parse error, unexpected T_STRING
<?php
$filecnt=0;
$imagedir='\images\sidebar\';
$dir=opendir($imagedir);
while($file=readdir($dir))
{
$filecnt++;
}
closedir($dir);
$images=array();
$imagetotal=3;
$unique=0;
while($unique<$imagetotal)
{
$tempnum=rand(1, $filecnt);
for($i=0;$i<$imagetotal;$i++)
{
if($tempnum==$images[$i])
break();
else
{
$images[$i]=$tempnum;
$unique++;
}
}
}
for($i=0;$i<$imagetotal;$i++)
{
echo '<img src='.$imagedir.'side'.$images[$i].'><br><br>';
}
?>
Any help would be appreciated.