on 09/03/03 8:10 AM, Charles Kline ([EMAIL PROTECTED]) wrote: > if(file_exists('cherpdocs/$annrow[id].doc')){ > echo "<br /><a href=\"cherpdocs/$annrow[id].doc\">Funding > details paper</a>"; > }
This is a pretty simple debugging type query, so: First things first, make sure that $annrow[id] is what you expect, by echoing it to the screen. <? echo $annrow[id] . "<br />"; ?> Then your file_exists() line has to use double quotes, because you're using a variable: file_exists("cherpdocs/$annrow[id].doc") Or better still, clarify exactly what you want by using {braces} or .'s file_exists("cherpdocs/{$annrow[id]}.doc") Or: file_exists("cherpdocs/" . $annrow[id] . ".doc") Same applies to your echo line. Summary, I think you can save yourself a little grief by making the following changes to your code. Personally, I prefer wrapping all vars in {braces} if inside a string. It also includes some minor debugging code, so that you can hunt down the issue. <? $file = "cherpdocs/{$annrow[id]}.doc" if(file_exists($file)) { echo "<br /><a href=\"{$file}\">Funding details paper</a>"; } else { echo "The file {$file} did not exist"; } ?> Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php