title: Update an image in php
body: <p>I have this form:</p>
  
  <pre><code>&lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" enctype="multipart/form-data"&gt;
      &lt;input type="file" name="file" /&gt;
      &lt;input type="submit" name="change" value="Update Image!" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and this action here : </p>
  
  <pre><code>if(isset($_POST['change']))
  {
      $id = $_POST['id'];
      $img = "photo_gallery/" .$_FILES["file"]["name"];
      $query = "UPDATE gallery SET image =\"{$img}\" WHERE id = $id";
      $up = mysql_query($query, $connection);
  
      if(!$up){
          echo die(mysql_error());
          echo "error,not updated!";
      }
  }
  </code></pre>
  
  <p>The error is: </p>
  
  <blockquote>
    <p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1</p>
  </blockquote>
  
  <p>Any help for finding the error please!</p>