On Fri, 18 Apr 2008 20:24:54 +0200 wrote "J.O. Aho"
:
>Henny Boxa wrote:
>> On my site is a database of articles in a few journals. The visitor
>> can get information by asking for the name of an author or a word in
>> the articles title. So far so good.
>> Some, but not all of the articles are in PDF. I would like to give the
>> visitor the opportunity to get the PDF file, but I want to present the
>> link only if there is a PDF file for this title. Is that possible?
>> At present the situation is:
>> while ($row=mysql_fetch_row($result))
>> {
>> echo"<td>$row[0]</td>";
>> echo"<td><a href=\"$row[5].pdf\">$row[1]</a></td>";
>> etcetera all relevant rows
>> }
>> As probably is clear row[0] contains authors, row[1] contains titles,
>> other row are used for finding place and in row[5] is the id of the
>> article (idart). This number is in the query but it is not presented
>> to the visitor. So the name of the PDF file is idart.pdf.
>> Should I make an if statement within the link?
>
>if(file_exists($row[5].'.pdf')) {
> echo "<a href=\"$row[5].pdf\">$row[1]</a>";
>}
Thank you very much indeed.
>> Stay informed about: how to make a link only if exists