March 9, 2004

php code

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);
?>

Posted by neps at March 9, 2004 12:04 AM | TrackBack
Comments

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 on March 16, 2004 2:56 AM

party poker <a href

Posted by: party poker on November 3, 2005 5:36 PM

party poker <a href

Posted by: party poker on November 4, 2005 4:39 AM

party poker <a href

Posted by: party poker on November 4, 2005 4:48 AM
Post a comment














Please enter the letter "g" in the field below: