title: Unable to display image from MySQL database using php
body: <p>I have a Products_Images table which stores the images in BLOB format. I want to show all the images and product details in 'View All Products' page. To accomplish this task I have created the following program, but its not giving me the desired output. Kindly check it.</p>
  
  <p>Thanks.</p>
  
  <pre><code>&lt;?php
  
  include 'connect.php';
  
  $query=         "select distinct product_id, image from product_images";
  
  $query_run=     mysql_query($query);
  
  while ($query_fetch=    mysql_fetch_assoc($query_run))
   {
  
  
  
  
       echo '&lt;/br&gt;';
       echo $query_fetch['image'];
  
  
   }
  
  header("Content-type: image/jpeg");
  
  
  
  
  
  ?&gt;
  </code></pre>
  
  <p><strong>Displaying The Image</strong></p>
  
  <pre><code>    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;/head&gt;
  &lt;br /&gt;
  &lt;img src="all_images.php" alt="Image" width="50" height="50" /&gt;
  &lt;body&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>