logo       

[PHP-INSTALL] Error trying to list images in a directory: msg#00079

php.install

Subject: [PHP-INSTALL] Error trying to list images in a directory

While trying to learn Php/MySQL from "Php 5/MySQL Programming for the
absolute beginner" book, I copied the exact code and yet ran into error
saying:

"Parse error: syntax error, unexpected $end in C:\Program Files\Apache
Group\Apache2\htdocs\Calendar\Two\test.php on line 41"

Line 41 is a line AFTER </html>

I might be missing something?


<?
$dirName = "C:\Program Files\Apache
Group\Apache2\htdocs\Calendar\Two\Images";
$dp = opendir($dirname);
chdir($dirName);

while($currFile !== false){
$currFile=readDir($dp);
$thefiles[]=$currentfile;
}

$imageFiles=preg_grep("/jpg$|gif$/", $thefiles);

$output = "";
foreach($imagefiles as $currentFile){
$output .= <<<HERE
<a href=$currentfile><img src="$currentfile"></a>
HERE;
}

$fp = fopen("imageindex.html","w");
fputs ($fp, $output);
fclose($fp);
print "<a href=$dirname/imageindex.html></a>\n";

?>



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise