I have a list of checkboxes that are assigned either a value of 1 or 0 that all get passed in the $\_POST variable.

My current sql statement inserts all of them correctly but when I change a value and run the sql statement again, it updates my "updated\_at" column for all the items.

Is there a way to only update changed values so it doesn't update the "updated\_at" column for every entry? id is my primary key and site\_id is unique.

SQL Statement:

```
        $sql = "INSERT INTO admin_sites2 (site_id,created_at,active)
                VALUES ('$key',now(),'$value')
                ON DUPLICATE KEY
                UPDATE active = $value,
                updated_at = now()
               ";

```