title: How to add font awesome icon dynamically based on some data
body: <p>Is it possible to change/add a font awesome icon based on the fetched data? 
  If the <code>type</code> is <code>.pdf</code> the font awesome will be <code>&lt;i class="fa fa-file-pdf-o"&gt;</code> else if <code>type</code> is <code>.docx</code> it will be <code>&lt;i class="fa fa-file-word-o"&gt;&lt;/i&gt;</code>. Can someone give me ideas how to do it? What will i use? Javascript or PHP? </p>
  
  <p>here's some of my code.</p>
  
  <pre><code> &lt;div class="col-sm-6 col-md-6"&gt;
      &lt;?php
                $sql ="SELECT * FROM lectures WHERE subj_descr = '$subj'";
                 $result = mysqli_query($con, $sql);
  
  
                 while($row = mysqli_fetch_array($result)){
                  $file = $row['file'];
                  $type = $row['type'];
  
          ?&gt;
  
      &lt;a style="display:block; margin-top:5px;" href="uploads/&lt;?php echo $file ?&gt;" target="_blank"&gt;&lt;i class="fa fa-file-word-o"&gt;&lt;/i&gt; &lt;?php echo $file; ?&gt;&lt;/i&gt;&lt;/a&gt;
  
           &lt;?php
            }  
           ?&gt;
      &lt;/div&gt;
  </code></pre>