[Cialug] Conditional logic for checking a file in PHP -- continued
Jerry Weida
cialug@cialug.org
Fri, 5 Nov 2004 12:37:30 -0600
Try this
<?
$filename="http://hostahaven.com/photos/".$row['HH_ID'].'.jpg';
if (fopen($filename, "r")) {
echo "<td width='200'><a href='$filename'>Click for photo</a>";
} else {
echo "<td width='200'>No Photo Available</td>";
}
?>
On Fri, 5 Nov 2004 12:29:47 -0600 (CST), Andrew Lietzow
<alietzow@myfamily.com> wrote:
> Here is some php code that does NOT work.
> I get this error.
> Parse error: parse error, unexpected T_STRING, expecting '('
>
> <?
> if fopen("http://hostahaven.com/photos/"+$row["HH_ID"]+'.jpg'","r")
> then <td width="200"><a href="http://hostahaven.com/photos/<?= $row["HH_ID"] ?>.jpg"</a>
> Click for photo</td>
> else <td width="200">No Photo Available</td>
> ?>
>
> If you want to refer me to a book that has good examples of this, or preferrably an online resource, that would be great.
>
> TIA for any help,
> Andrew
>
> _____________________________________________________________________
> Get your own family web site at www.MyFamily.com!
>
>