Updating database record on page load


I have developed a private messaging system, I want to mark a message read when a user opens it but I cannot seem to get the record in the database to update.

The messages are listed on the messages.php page.

The have a link like messages-view.php?mid=21 which takes the user to a single view page.

On that page the following PHP function is called:
<?php pm_markread($_SESSION['user']['id'],$_GET['mid'],'1'); ?>

That funs the following SQL query:

    function pm_markread($uid,$mid,$status) {
        require 'includes/db.config.php';

    $sql = "UPDATE messages SET id = :id,
                    msg_read = :msg_read 
            WHERE msg_touserid = :msg_touserid";
            $stmt = $db->prepare($sql);                                  
            $stmt->bindParam(':id', $mid, PDO::PARAM_STR); 
            $stmt->bindParam(':msg_touserid', $uid, PDO::PARAM_STR);     
            $stmt->bindParam(':msg_read', $status, PDO::PARAM_INT);   

The ‘1’ is the value that should be inserted into the msg_read column of my database, the default (unread) value is ‘0’.

The update doesn’t seem to be happening. I’m not sure what is broken.