I have a form to update details of a user and they do not have to fill in every field. Because of that, it will be passing an empty string to the database via POST. This is my query:
$q = "UPDATE mdl_user SET firstname='$fname', lastname='$lname', email='$email',
address='$address', city='$city', school='$school', phone1='$phone'
WHERE id='$uid'";
Is there a way for MySQL to check if for example $fname is an empty string and if it's empty don't update that field?
If not then how should I go about doing this in PHP?