mercredi 30 mars 2016

php link between td if file exists

i am trying add a link to my search results but i want that to check if the file exists before adding the link i want that to be something like that.

 echo'<tr>
<td style=font-family:Gadugi;font-size:16px; width:50px; align:"left";>'.$result["BASECODE"].'

<?php
if (file_exists("images/'.$result["BASECODE"].'.png")) 
{
echo "<a href="images/'.$result["BASECODE"].'.png">img</a>";
}
?>
</td>

<td style=font-family:Gadugi;font-size:16px; width:50px;align:"left";>'.$result["KNITTYPE"].'</td>
<td style=font-family:Gadugi;font-size:16px; width:250px;align:"left";>'.$result["COMPOSITION"].'</td>
<td style=font-family:Gadugi;font-size:16px; width:100px;align:"left";>'.$result['REALWEIGHT'].'</td>
<td style=font-family:Gadugi;font-size:16px; width:100px;align:"left";>'.$result["REALWIDTH"].'</td></tr>';

Aucun commentaire:

Enregistrer un commentaire