title: Displaying PNG images from MySQL
body: <p>I'm trying to display an image from a MySQL database and my code works fine if the image is a JPG, but if I modify the content-type to display a PNG, it doesn't work...
  How do I make it work for PNG??</p>
  
  <pre><code>&lt;?php
  
      // configuration
      require("../includes/config.php"); 
  
      header('Content-type: image/JPG');
      $username = "xxxxx";
      $password = "*****";
      $host = "localhost";
      $database = "database";
      @mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());
      @mysql_select_db($database) or die("Can not select the database: ".mysql_error());
      $query = mysql_query("SELECT * FROM images");
  
      while($row = mysql_fetch_array($query))
      {
          echo $row['image'];
      }
  ?&gt;
  </code></pre>
  
  <p>Also, is it possible to display the image along with its name and description? 
  Thanks!</p>