Lets say you have a form which allows someone to change there personal data in a database. The user only wants to change their phone number and leave everything else the same does anyone know how to change the row with the phone number in?

My current code updates all the rows in the form which are left blank as blank inputs.

Current Database:

First Name: Joe
Surname: Bloggs
Phone Number: 123456789

Update Form:

First Name:
Surname:
Phone Number: 987654321

Incorrect Updated Database:

First Name:
Surname:
Phone Number: 987654321


Correct Updated Database:

First Name: Joe
Surname: Bloggs
Phone Number: 987654321



I need something that says: If blank do not update.





Code:
function mysql_real_escape_array($t)
{
    return array_map("mysql_real_escape_string",$t);
}

function trim_array($ar)
{
    return array_map("trim",$ar);
}

if(isset($_POST['form_id']))
{
    $_POST = mysql_real_escape_array($_POST);
    $_POST = trim_array($_POST);
    $error = "";

 
    if($error == "")
    {
        $sql = "
        UPDATE
            users
        SET
            category = '".$_POST['category']."',
		linkcategory = '".str_replace(' ', '-',strtolower($_POST['category']))."',
            firstname = '".$_POST['firstname']."',
            surname = '".$_POST['surname']."',
            email = '".$_POST['email']."',
            website = '".$_POST['website']."',
            company = '".$_POST['company']."',
            building = '".$_POST['building']."',
            streetname = '".$_POST['streetname']."',
			town = '".$_POST['town']."',
            state = '".$_POST['state']."',
            postcode = '".$_POST['postcode']."',
            aboutcompany = '".$_POST['aboutcompany']."',
			country = '".$_POST['country']."'
			         WHERE 
			id=$id";

        $result = mysql_query($sql) or die("An error occurred ".mysql_error());

    }