On Mon, 6 May 2002, Craig Westerman wrote:
> What am I doing wrong? I get parse error between first echo statement and
> else.
> 
> <?php
> $fn = "image.gif";
> if (!file_exists($fn)) {
> echo "<img src=noimageexists.gif>";
> else
> echo "<img src=$fn>";
> }
> ?>

You open the brace for the positive branch of the if and then leave it 
open surrounding the else condition.

WRONG:

if (condition)
{ do something;
else
  do something else;
}

RIGHT:

if (condition)
{ do something; }
else { do something else; }

As for "finding the problem" with file_exists' limitation to local files, 
that's a different problem.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to