Simplify This PHP Script
<p>I wrote a PHP script earlier that will check to see if certain fields have changed, and only update those fields. The script works fine, but I think it may be a tad inefficient. Could anyone suggest a way to simply this and improve its simplicity?</p>

<pre><code>public function save_bio_and_interests($bio, $interests, $publications, $person_id='') {

    $person_id = $this-&gt;get_person_id($person_id);

    // The first thing we want to do is see if any of this has changed. If it hasn't changed, it doesn't need to be submitted for approval.
    $current_info = $this-&gt;get_bio_and_interests($person_id);
    $bio_c = $current_info['biography_approved'];
    $interests_c = $current_info['interests_approved'];
    $pubs_c = $current_info['publications'];

    if ($bio != $bio_c) {
        $update['biography_draft'] = $bio;
    }

    if ($interests != $interests_c) {
        $update['interests_draft'] = $interests;
    }

    if ($publications != $pubs_c) {
        $update['publications'] = $publications;
    }


    // If something is to be updated, do it. Otherwise, return true.
    if ($update) {

        // Get keys and values for an INSERT
        $keys = join(", ", array_keys($update));
        $values = "'" . join("', '", array_values($update)) . "'";  

        // Create an UPDATE querty
        foreach($update as $key=&gt;$value) {
            $update_string[] = "$key='$value'";
        }

        // Glue it together
        $update = join(", ", $update_string);

        $q = "INSERT INTO biographies (person_id, $keys) VALUES ('$person_id', $values) ON DUPLICATE KEY UPDATE $update;";
        $v = mysql_query($q);

        if ($v) {
            return true;
        } else {
            throw new Exception(mysql_error());
        }

    } else {
        return true;
    }
}
</code></pre>
