title: Insert Blobs in MySql databases with php
body: <p>I am trying to store an image in the DataBase, for some reason it doesn't seem to work. Here's the structure of my table.</p>
  
  <pre><code>mysql&gt; describe ImageStore;
  +---------+----------+------+-----+---------+-------+
  | Field   | Type     | Null | Key | Default | Extra |
  +---------+----------+------+-----+---------+-------+
  | ImageId | int(11)  | NO   | PRI | NULL    |       |
  | Image   | longblob | NO   |     | NULL    |       |
  +---------+----------+------+-----+---------+-------+
  2 rows in set (0.01 sec)
  </code></pre>
  
  <p>And here is my query which inserts the image or at least thats what it should:</p>
  
  <pre><code>//Store the binary image into the database
                  $tmp_img = $this-&gt;image['tmp_name'];
                  $sql = "INSERT INTO ImageStore(ImageId,Image)               
                  VALUES('$this-&gt;image_id','file_get_contents($tmp_image)')";
                  mysql_query($sql); 
  </code></pre>
  
  <p>If I print the value of file_get_contents($tmp_image), then there is a tons of data on the screen. But this value doesn't get stored in the database and that is the issue that I'm facing.</p>