i dont really get what your trying to do, seems to me like your trying to get info from a 2 different fields and make it into one link. for example, in your query $result let's say you did this
$result=mysql_query("select * from table where blah='blahblah'") so that only one row is returned, that row has 2 coloums, filename and link. Then I would go
$filename=mysql_result($result,0,'FileName);
$link=mysql_result($result,0,'link');
echo "<a href='$link'>$filename</a>";
was that it, if not, explain more and I might be able to help