i am experiencing trouble with MYSQL Update and i don't know how to fix it. i'm new to MYSQL : here my codeblock: public function updateTable($obj, $column_names, $table_name, $bannerid) {
        
        $c = (array) $obj;
        $id = $bannerid;
        $keys = array_keys($c);
        $columns = '';
        $values = '';
        foreach($column_names as $desired_key){ // Check the obj received. If blank insert blank into the array.
           if(!in_array($desired_key, $keys)) {
                $$desired_key = '';
            }else{
                $$desired_key = $c[$desired_key];
            }
            $columns = $columns.$desired_key.',';
            $values = $values."'".$$desired_key."',";
        }
        //$query = "INSERT INTO ".$table_name."(".trim($columns,',').") VALUES(".trim($values,',').")";
        //mysql_query("UPDATE blogEntry SET content = '$udcontent', title = '$udtitle' WHERE id = $id");
        $query = "UPDATE ".$table_name." SET "."(".trim($columns,',').") = VALUES(".trim($values,',').")" ."WHERE id = '$id'" ;
        $r = $this->conn->query($query) or die($this->conn->error.__LINE__);

        if ($r) {
            $new_row_id_update = $this->conn->insert_id;
            return $new_row_id_update;
            } else {
            return NULL;
        }
    } 

here is the error i got: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(image_url,intro) = VALUES('800bf5f59a1d13c8.jpg',',sd,cfcjaklewfh ewiuofejkfdh ' at line 1100