title: PHP/mysql conditional update query
body: <p>I am trying to submit data to a database.  I have an update form that has several fields on it that pulls data from the database into the fields.  Submitting it updates the data in the database.  The two fields i am concerned with our two image uploaders that i have in the form.  I have been doing this successfully when i have only one image uploader on the page, but can't wrap my head around the conditional syntax when i add the second one.  Below is the code that i am using for the forms that have only one image uploader.  It looks to see if that submitted element is empty.  If so, it runs an update statement and leaves out the image variable.  If the image variable is not empty it runs an update statement with that field added to the statement.</p>
  
  <pre><code>if($imgProfileFull == ""){
  $query = "update students set `nameFirst` = '$nameFirst', `nameLast` = '$nameLast', `profile` = '$profile', `priority` = '$priority', `active` = '$active', `_modifiedDate` = '$_modifiedDate' where `id` = '$id'";
  }else{
  if((($_FILES["image"]["type"] == "image/jpeg")
  || ($_FILES["image"]["type"] == "image/pjpeg"))
  &amp;&amp; ($_FILES["image"]["size"] &lt; 500000))
  {
    if($_FILES["image"]["error"] &gt; 0){
      header("location:students.php?file=error");
    }else{
      move_uploaded_file($_FILES["image"]["tmp_name"],
      "../images/students/full/" . $imgProfileFull);
    }
  }else{
    header("location:students.php?file=error");
  }
  $query = "update students set `imgProfileFull` = '$imgProfileFull', `nameFirst` = '$nameFirst', `nameLast` = '$nameLast', `profile` = '$profile', `priority` = '$priority', `active` = '$active', `_modifiedDate` = '$_modifiedDate' where `id` = '$id'";
  }
  </code></pre>
  
  <p>How would i write my update statement to include another image field.  The variable would be <code>$imgProfileThumb</code>.  Basically i want to update the two image columns in the database if, and only if, they are NOT empty.  This is because the way the form is built, the image field is technically always empty unless an image actually gets uploaded.  Any thoughts?  Thanks!!</p>