title: PDO insert image in db and retrieve the image
body: <p>I am trying to insert image in DB but for some reasons I could not retrieve it. I am using BLOB type for images in database. </p>
  
  <p>Code I am using to upload image. Once I save image in db, in "IMAGE" column I get file image-01.bin </p>
  
  <pre><code>if (isset($_POST["submit"]) {
  
    $id= $_GET["id"];
    $image = $_POST["image"];
  
    $stmt=$conn-&gt;prepare("INSERT INTO db (id, image) VALUES (:id, :image)");
  
    $stmt-&gt;bindParam(:id, $id);
    $stmt-&gt;bindParam(:image, $image);
    $stmt-&gt;execute();
  }
  </code></pre>
  
  <p>Code I am using to print image in web page.</p>
  
  <pre><code>$stmt = "Select Id, Image from db where id = $id LIMIT 0,1"
  
  $q = $conn-&gt;query($stmt);
  
  while ($r = $q -&gt;fetch():
    echo "&lt;img src ='",$r[Image],"' width='100' height='100' /&gt;";
  endwhile;
  </code></pre>