title: how to change longblob to image in php
body: <p>I'm trying to get data from a table inside MySQL then put it inside an html table. Almost all the data appears right, but the images that i stored in long blob bugs and appears codified as a lot of characters instead. Everything else in functional as intended. Inside the code foto=longblob image.</p>
  
  <pre><code>&lt;?php
        $tipo =$_GET["tipo"];
        $conexao = mysqli_connect("127.0.0.1","root","","db_tcc") or die ("Não foi possível se conectar com o servidor.");
  
  
  
  
  
          switch($tipo){
              case "0":
                      $varsql = "SELECT * FROM tb_locaissp ORDER BY id ASC";
                      break;
  
              case "1": case "2": case "3":
                      $varsql = "SELECT * FROM tb_locaissp WHERE TIPO='$tipo' ORDER BY id ASC";
                      break;
      }
  
  
            $carregar_guias = mysqli_query($conexao, $varsql);
  
        while ($linha = mysqli_fetch_array($carregar_guias))
        {
          $id = $linha["ID"];
          $img = $linha["FOTO"];
          $nome = $linha["NOME"];
          $desc = $linha["DESCRICAO"];
  
  
  
  
          echo "&lt;div class='loc'&gt;
          &lt;table class='tablel'&gt;
          &lt;tr&gt;&lt;td class='nome'&gt;$nome&lt;/td&gt;  &lt;td&gt;&lt;img class='contador' src='like' '&gt; &lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td class='imglo'&gt;&lt;img src='$img'&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td class='desc'&gt;$desc&lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;&lt;/div&gt;";
          echo "&lt;br&gt;&lt;br&gt;";
  
        }
      ?&gt;
  </code></pre>