title: PHP/MYSQL UPDATE only if value is not null
body: <p>I'm building a form to update multiple columns of data. This code has been partially successful for my purposes. The only thing left to do is include (if IS NOT NULL) for the update query. I'm not sure how to go about this.</p>
  
  <p>In other words, I only want the UPDATE to execute if the $_POST value is not empty.</p>
  
  <pre><code>&lt;form&gt;
  &lt;input type='text' name='input1' /&gt;
  &lt;input type='text' name='input2' /&gt;
  &lt;input type='text' name='input3' /&gt;
  &lt;input type='submit' value='submit' /&gt;
  &lt;/form&gt;
  
  &lt;?php
  //db connect
  
  $1=$_POST['input1'];
  $2=$_POST['input2'];
  $3=$_POST['input3'];
  
  mysql_query("UPDATE table
               SET a = $1
                   b = $2
                   c = $3
               WHERE row = 'row_id");
  
  );
  
  
  ?&gt;
  </code></pre>
  
  <p>Thanks in advance for the help.</p>
  
  <p>(To save you from some extra typing, my original code escapes characters so warnings of SQL injections aren't necessary. I'm also in the process of familiarizing myself with "mysqli_query", so no need to comment on that either.) </p>