I've made this dynamic update function, based on the fetch function, (same method, just another array for SET).

But it appears like there is an error with it.

```
    public function update($table, $columns = array(), array $criteria = null)
    {
        // The query base
        $query = "UPDATE $table";

        $query .= ' SET ' . implode(', ', array_map(function($column) {
            return "$column = ?";
        }, array_keys($columns)));

        // Start checking
        if ($criteria) {
            $query .= ' WHERE ' . implode(' AND ', array_map(function($column) {
                return "$column = ?";
            }, array_keys($criteria)));
        }

        $update = $this->pdo->prepare($query) or die('An error has occurred with the following message:' . $query);
        $update->execute(array_values($criteria));
    }

```

And that is the error I am getting (Line 179 = `$update->execute(array\_values($columns, $criteria));):

What is wrong with it? why am I getting that error?

EDIT NEW ERROR:

```
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in C:\xampp\htdocs\argonite\includes\class\MYSQL\Database.class.php:179 Stack trace: #0 C:\xampp\htdocs\argonite\includes\class\MYSQL\Database.class.php(179): PDOStatement->execute(Array) #1 C:\xampp\htdocs\argonite\index.php(8): Database->update('argonite_server...', Array, Array) #2 {main} thrown in C:\xampp\htdocs\argonite\includes\class\MYSQL\Database.class.php on line 179

```