title: MySQL update column only if value not empty where
body: <p>I have an UPDATE query and using Ajax, I wanted to know if any value is empty can I only update the values that not empty in the database. I don't know if this is possible to have a if statement or something to check to skip the empty values. I know I can just add another form element but just wanted to know if there was another solution. </p>
  
  <p>Only if the data is POST from front end form. If data not POST don't update this <code>Title</code> = '.$title .',</p>
  
  <pre><code>$id = $_POST['id'];
  $title = "";
  $description = $_POST['Description'];
  $date = $_POST['Date'];
  
   $query = 'UPDATE user SET
  
    `id` = '.$id.', 
    `Title` = '.$title .', 
    `Description` = '.$description.', 
    `Date` = '.$date =.' 
    WHERE `id` = '.$id;
  
   $result = mysql_query($query) or die("&lt;b&gt;A fatal MySQL error occured&lt;/b&gt;.&lt;br /&gt;Query:  ".$query."&lt;br /&gt;Error: (".mysql_errno().") ".mysql_error());
  </code></pre>
  
  <p>Update: This is what worked for me. Thanks Karim Daraf</p>
  
  <p>$query = " UPDATE user SET 
         <code>Title</code> = Coalesce($title,<code>Title</code> ) etc... </p>