title: How to show download link for a subscribed product?
body: <p>Using a <code>function</code> I can create some parameters to show and hide certain things.</p>
  
  <pre><code>function loggedin(){
      return (isset($_SESSION['UserId'])) ? true : false;
  }
  
  if (loggedin() === true){
    echo"Welcome $name";
  } else {
    echo"&lt;a href="access.php"&gt;Log in&lt;/a&gt;";
  }
  </code></pre>
  
  <p>Another way to hide content for a user is as follows:</p>
  
  <pre><code>if (loggedin() === false)
  </code></pre>
  
  <p>How can I make a similar parameter to hide and display data of a product subscribed by a user?</p>
  
  <blockquote>
    <p>That is to say when you log in a user who has acquired or who proceeded to subscribe to a product and if the state of the product is <code>complete</code> hide the price (or hide some content) and instead of the price show the download link of the file of the product.</p>
  </blockquote>
  
  <p>How should the consultation be considered and show results?</p>
  
  <p>I have the following table called subscribed this is shaped this way</p>
  
  <pre><code>id_subscribed | id_product | UserId | number_facture | status  | date |
       1             5          2         4562344       complete   null
       2             5          9         4562345      incomplete  null
  </code></pre>
  
  <p>The table of products</p>
  
  <pre><code>id_product  |  product | price | archive |
      5          null      40.00   data.zip
  </code></pre>
  
  <p>The Users table</p>
  
  <pre><code>UserId  | name  | last_name  | usuername | email | password
    2       Juan       null        juan10   @...    q1dxe333f
    9       Pedro      null        pedro1   @...    wfrf653gg
  </code></pre>