title: Open dynamic file (fopen)
body: <p>I'm trying to open a document that users have previously uploaded to my site. From resarch I get that fopen() (<a href="http://php.net/manual/en/function.fopen.php" rel="nofollow">http://php.net/manual/en/function.fopen.php</a> ) is a good alternative but I just don't get it. The link for a document only shows if a document has actually been uploaded before (which I have managed to do). Clicking on that link should open the file in whatever format it is (Word for doc/docx, pdf-reader for pdf etc). In this case I'm lost both when it comes to how to write this in HTML and PHP.</p>
  
  <p>The last attemp I tried was this:</p>
  
  <pre><code>&lt;p&gt;&lt;a href="#" target="_blank"&gt;Word Lesson Plan&lt;/a&gt;';
  if((!empty($row["File"])))
  { echo' | &lt;a href="'fopen($row["File"],"r");'"&gt;For Students&lt;/a&gt;';}
  echo '&lt;/p&gt;
  </code></pre>
  
  <p>But it's not even displaying the page like that. I'm really stuck with this. How do I add a link to the file in the database dynamically and only show it if there is a file in the database?</p>
  
  <p>/Håkan</p>