[Cialug] RE: Using conditional logic within PHP

Andrew Lietzow cialug@cialug.org
Fri, 5 Nov 2004 11:17:14 -0600 (CST)


This is a multi-part message in MIME format.
If you can read this line, your email software does not support this format.
--MyFaMiLyMiMeBoUnDaRy02292000
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hello LAMP brainiacs. I Need help with "if then else" logic in with PHP and HTML. 

Here is a page that lists some plants. 
http://hostahaven.com/pages/whatsnew/HH_ID.php

For some of the items, I have a photo while for others, I have not at present.  I'd like to add a conditional statement that checks for the existence of the jpg file in the appropriate directory, and if it doesn't exist, print the text "No Photo" rather than "Click for Photo". 

I assume I can do some kind of file checking, like 
$file=fopen("foo","r") or die("Error!"); 
but I'm a bit lost on the foo and the r.   In place of foo, could I put  "http://domain.com/photos/"+$HH_ID+'.jpg'     ? where HH_ID is item number to the left of the .jpg?   

This tutorial gets me close to an answer (e.g. http://www.htmlgoodies.com/php/p11filesystem.html) but doesn't clarify how I check for a file in a particular directory.  

Hints would be greatly appreciated.   
  
Andrew Lietzow

     


_____________________________________________________________________
Get your own family web site at www.MyFamily.com!




--MyFaMiLyMiMeBoUnDaRy02292000--