title: PHP: Inserting Blob Image to SQLite table
body: <p>i'm trying to insert an image using (cakephp) to sqlite DB in a BLOB column.</p>
  
  <p>i'm using this code </p>
  
  <pre><code>$insert = "INSERT INTO story (page, image) 
                      VALUES (:page, :image)";
          $stmt = $file_db-&gt;prepare($insert);
  
          // Bind parameters to statement variables
          $img = file_get_contents($this-&gt;request-&gt;data['image']['tmp_name']);
          $img = mysql_real_escape_string($img);
          $stmt-&gt;bindParam(':page', $this-&gt;request-&gt;data['page']);
          $stmt-&gt;bindParam(':image', $img);
  
             // Execute statement
            $stmt-&gt;execute();
  </code></pre>
  
  <p>and it's inserting but a characters set not a blob data as it suppose to be.. is there any other way to do it or else what is the wrong with my code?</p>