Hi! maybe my English is not perfect, but anyway, I've this problem with php: in this script I want to calculate the number of images are inside a folder(path-->thumbs/foto/). But when I try to use it I receive this error: "Parse error: parse error, expecting `';'' in C:\wamp\www\gallery\gallery_visual.php on line 21". I can't understand where I have to put this damn ";". Of course I'm not a boss about php..... Some ideas? Thank a lot! <?php $nome_cartella = "thumbs/foto/"; $handle = opendir($nome_cartella); while (false != ($file = readdir($handle))) { if ( $file == ".." || $file == ".") { $fotografie=Array($file); $number=count($fotografie); for (i=0; i<=$number; i++){ echo $fotografie; } ?>
The problem here is with the For Loop for (i=0; i<=$number; i++){ echo $fotografie[i]; } PHP: While it's supposed to be: for ($i=0; $i<=$number; $i++){ echo $fotografie[$i]; } PHP: Oh and you've forgotten to close the "{" <?php $nome_cartella = "thumbs/foto/"; $handle = opendir($nome_cartella); while (false != ($file = readdir($handle))) { if ( $file == ".." || $file == ".") { $fotografie=Array($file); $number=count($fotografie); for (i=0; i<=$number; i++){ echo $fotografie[i]; } } } ?> PHP:
Try this code: <?php $nome_cartella = "thumbs/foto/"; $handle = opendir($nome_cartella); while (false != ($file = readdir($handle))) { if ( $file == ".." || $file == ".") { $fotografie=Array($file); $number=count($fotografie); for ($i=0; $i<=$number; $i++) { echo $fotografie[i]; } } } ?> PHP: Formatted