title: how to display images from database in php?
body: <p>i write bellow code to display images from database</p>
  
  <pre><code>&lt;?php
  mysql_connect("localhost","root","");
  mysql_select_db("test");
  $qry = "select id from image";
  $res = mysql_query($qry) or die(mysql_error());
  while($row = mysql_fetch_array($res))
  {
    echo "&lt;img src=image.php?id='$row[0]'&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>Image.php</p>
  
  <pre><code>&lt;?php
  $query = mysql_query("SELECT img FROM images WHERE id = ".$_GET['id']);
  $row = mysql_fetch_array($query);
  if($type=="pjpeg")
  $type="jpeg";
  header("Content-type:$type");
  echo $row['img'];
  ?&gt;
  </code></pre>
  
  <p>but this will not work. it display blank image icon.</p>