I want to set null in a table column if the input submitted by a user is an empty string.

More specifically the user may enter or not the wwwaddress of his site-if he has one.

Here is the code that checks if the user submitted an empty string or not and setting NULL to the
db table if indeed he has done so.

Code:
function ajax_update_address($address,$city,$municipality,$wwwaddress)
{
     global $conn; 
     $conn->set_charset("utf8");
     if($wwwaddress==' ')
     {$www=NULL;}
        
       $result = $conn->query('update busines_users
            set address="'.$address.'",city="'.$city.'",municipality="'.$municipality.'",wwwaddress="'.$www.'"
            where crID="12"');
         if (!$result){
         echo 'problem dude.';
         return false;
          }
          else
        {return true;} 
       
       
 }
Unfortunately it does not work,in the db table in the wwwaddress column I still get an empty string.
This conditional you see fails to do what it supposes to do.:
Code:
  if($wwwaddress==' ')
     {$www=NULL;}