I have a form for updating user information, and they do not need to fill out each field. Because of this, it will pass an empty string to the database via POST. This is my request:
$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 an empty string, and if it is empty, do not update this field?
If not, how should I do this in PHP?
source share