title: Updating image into databse using php and mysql
body: <p>i want to store an image in database not by inserting but by updating (by using UPDATE query).</p>
  
  <p>Everything else is updated successfully but its not storing image. I'm using medium blob data type to store image.</p>
  
  <p>Here is my code:</p>
  
  <p>update-profile.php:</p>
  
  <pre><code>  &lt;form id="form" method="post" action="update-profile-action.php"   enctype="multipart/form-data"&gt;
      &lt;label for="Fname"&gt;First Name:&lt;/label&gt; &lt;input type="text" id="Fname" class="text"  value="&lt;?php echo $firstname; ?&gt;" name="Fname" /&gt; &lt;br /&gt;&lt;br /&gt;
       &lt;label for="Lname"&gt;Last Name:&lt;/label&gt; &lt;input type="text" id="Lname" class="text"    value="&lt;?php echo $lastname; ?&gt;" name="Lname" /&gt;&lt;br /&gt; &lt;br /&gt;
  
  &lt;?php 
  if ($_SESSION["type"]=="T")
  {
  ?&gt;        
      &lt;label&gt;Profile Image:&lt;/label&gt; &lt;input type="file" name="image" value="" /&gt;&lt;br     /&gt;     &lt;br /&gt;
       &lt;label&gt;Qualification:&lt;/label&gt;&lt;textarea name="qualification" class="text"  id="qualification"&gt;&lt;?php echo $qualification;?&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
      &lt;label&gt;Education &amp; Teaching History:&lt;/label&gt; &lt;textarea name="briefintro"     class="text" id="intro"&gt;&lt;?php echo $briefintro; ?&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;?php
  }
  ?&gt;
      &lt;input type="submit" class="mybutton" value="Update Profile" /&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>update-profile-action.php:</p>
  
  <pre><code>&lt;?php include("../includes/config.php");?&gt;
  &lt;?php
  $Fname=$_POST["Fname"];
  $Lname=$_POST["Lname"];
  $image=$_POST["profileimg"];
  $briefintro=$_POST["briefintro"];
  $qualification=$_POST["qualification"];
  
  $con=mysql_connect($dbserver,$dbusername,$dbpassword);
  if (!$con) { die('Could not connect: ' . mysql_error()); }
  mysql_select_db($dbname, $con);
  $query=("UPDATE accounts SET firstname='".$Fname."' , lastname='".$Lname."' ,  profileimg='".$image."' ,  briefintro='".$briefintro."',    qualification='".$qualification."' WHERE id=".$_SESSION['id']);
  $result = mysql_query($query);
  header("Location: update-profile.php?status=3");
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>i copied only the related data from update-profile.php to making it more easy to read :)
  any kind of help will be appreciated :)</p>