title: Issue with updating image info on MYSQL database using PHP
body: <p>I'm having problem with my code. I can't update my image.</p>
  
  <p>Here is my full code:</p>
  
  <h3>index.php</h3>
  
  <pre><code>//this link will post my data to next page
  &lt;a href="updatepage.php?code=&lt;?php echo $row['name']; ?&gt;"&gt;update&lt;/a&gt; 
  </code></pre>
  
  <h3>updatepage.php</h3>
  
  <pre><code> //this page will get all data that want to update...
   &lt;?php
   include("config.php");
   $name=$_GET['code'];
   $sql1  = "select * from imagename where name='$name'";
   $result = mysql_query($sql1) or die(mysql_error());
   $row=mysql_fetch_array($result);?&gt;
  &lt;form name="form1" method="post" action="processupdatepage.php"  class="formposition" enctype="multipart/form-data" &gt;
    &lt;table&gt;
     &lt;tr&gt;&lt;td&gt;
      &lt;input type="hidden" name="id" value="&lt;?php echo $row['id']; ?&gt;" /&gt;&lt;/td&gt;&lt;/tr&gt;
     &lt;tr&gt;&lt;td width="98"&gt;Image&lt;/td&gt;&lt;td width="288"&gt;
    //This is where I have problem, I can't get my image value but other data value work very well.....
      &lt;input type="file" name="image" value="&lt;?php echo $row['image'];?&gt;" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br/&gt; 
     &lt;tr&gt;&lt;td&gt;nane&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="name" value="&lt;?php echo $row['name']; ?&gt;"/&gt;&lt;/td&gt;&lt;/tr&gt;&lt;br/&gt;       
     &lt;tr&gt;&lt;td&gt;&lt;/td&gt; &lt;td colspan="2"&gt;
      &lt;input type="submit" name="submit" value="Save" /&gt;  &lt;/td&gt;&lt;/tr&gt;
    &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>OK. Now this my process file:</p>
  
  <h3>processupdatepage.php</h3>
  
  <pre><code>&lt;?php
  include("config.php");
  $id=$_POST['id'];
  $image=$_FILES['image']['name'];
  $name=$_POST['name'];
  $target = "images/"; 
  $target = $target . basename( $_FILES['image']['name']);
  $query = "UPDATE imagename SET name='$name', image='$image' WHERE id='$id'";
  $bb = mysql_query($query) or die(mysql_error());
  if($bb)
  {
  //Writes the photo to the server 
      if(move_uploaded_file($_FILES['image']['tmp_name'], $target)) 
      {  
        $sql001="UPDATE imagename SET image='$image' WHERE image='$image'";
      mysql_query($sql001);
      } else { } 
      header("Location:index.php");
  }
  else
  {
      echo "Could not be updated";
  }
  ?&gt;
  </code></pre>
  
  <p>I can update BUT must select image. If I'm not selecting an image, my image field in database will be empty BUT other data updates are OK...</p>