Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [PHP-INSTALL] Error trying to list images in a directory
Scott Hamm wrote:

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

If you mean that line 41 is a line number after your program ends, this
usually means that something is not closed. That is, a missing } or ) or
perhaps an opening " with no closing ". Sometimes it's using a } when it
should be a ) or a ) that should be a }.

Check out your heredoc. The first HERE must have nothing after it on the
line, not even a blank space. The second HERE must begin at the very
beginning of the line, with nothing before it, not even a blank space.

Janet


--
Janet Valade -- janet.valade.com

Report this thread to moderator Post Follow-up to this message
Old Post
Janet Valade
10-20-04 09:01 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Installation archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:59 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.