title: Displaying an image from the DB using php
body: <p>Hey guys am having trouble displaying an image from the DB on a web page.</p>
  
  <p>Am using this to display</p>
  
  <pre><code>echo "&lt;img
  </code></pre>
  
  <p>src=image.php?"' width=300 height=270/>";</p>
  
  <p>here is my image.PHP</p>
  
  <pre><code>&lt;?php
  session_start();
  $con1=mysql_connect("localhost","root","roots");
  mysql_select_db("blog",$con1);
  if(!$con1)
  {
    die('could not connect'.mysql_error());
  }
  
  $q="select image from data where Number=1";
  $result= mysql_query($q,$con1);
  if($result)
  {
  $row=mysql_fetch_array($result);
  header("content-type:image/jpeg");
  echo $row['image'];
  
  }
  else
  {
    echo mysql_error();
  }
  ?&gt;
  </code></pre>