I've written a function that should replace ?'s with values from an array, but I can't get it to work.

```
 public function exec($sql, Array $params = array()) {
            if($query = $this->db->prepare($sql)) {
                    $x = 1;
                    if(count($params)) {
                            foreach($params as $param) {
                                    $query->bindParam($x, $param);
                                    $x++;
                            }
                    }
            }
            $query->execute();
            print_r($query);

```

Query:

```
$mysql->exec("SELECT * FROM test where id = ?", array(0));

```

Output:

```
PDOStatement Object ( [queryString] => SELECT * FROM test where id = ? )

```