title: mysqli prepared statement - do not update NULL values
body: <p>I have a prepared statement to update several fields. I get the data from a formular, but not all fields are required. So it's possible that some fields are not set. I set them default to NULL. Now I don't want to overwrite the old value by NULL. How can I tell MySql not to Update the value if it's NULL?</p>
  
  <pre><code>$insert_stmt = $mysqli-&gt;prepare("
  UPDATE members SET username=?, email=?,  $password=?, $random_salt=?, level=?, customerID=?, name=?, surname=?, phone=?, quantities=? WHERE id=?
  ");
  $insert_stmt-&gt;bind_param('ssssissss', $username, $email, $password, $random_salt, $level, $customerID, $firstname, $surname, $phone);
  $insert_stmt-&gt;execute();
  </code></pre>
  
  <p>In my case it's the password and random_salt value that could be NULL. It will be very bad to overwrite the password just by NULL ;)</p>