i have this bit of code i'm stuck on, perhaps some good soul out there can see what I'm doing wrong?
I have this directory, where X number of include files reside. This code, loads X number of include files and displays them randomly. The X variable is not defined in the code, but picked up from the directory itself. So the code is successfully loading the folder, however is not displaying them randomly.
Any thoughts? Seems so simple, but I feel at a loss.
<?php $filedir = "photographers"; //The file folder
$i=0;$handle = opendir($filedir);
while (false !==($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
include("$filedir/$file");
++$i;
}
}closedir($handle);
?>

Comments (1)
Well, I'm not a php expert (so I'm not going to catch you on syntax errors), but I suspect you're not giving us enough information.
What is the value of $i after this loop? Perhaps it's being set correctly, but you're not using the value correctly with the rand call?
Posted by whatisee | March 16, 2004 2:56 AM
Posted on March 16, 2004 02:56