public function run($sql, array $params = array())
    {
        $sth = $this->pdo->prepare($sql);

        foreach ($params as $key => $value) {
            $key = is_numeric($key) ? $key + 1 : ":$key";
            $sth->bindValue($key, $value);
        }

        $sth->execute($params);
        $this->executed[] = $sql;
        return $sth;
    }
public function run($sql, array $params = array())
    {
        $sth = $this->pdo->prepare($sql);

        foreach ($params as $key => $value) {
            $key = is_numeric($key) ? $key + 1 : ":$key";
            $sth->bindValue($key, $value);
        }

        $sth->execute($params);
        $this->executed[] = $sql;
        return $sth;
    }
public function run ( $ sql , array $ params = array ( ) ) { $ sth = $ this -> pdo -> prepare ( $ sql ) ; foreach ( $ params as $ key => $ value ) { $ key = is_numeric ( $ key ) ? $ key + 1 : ":$key" ; $ sth -> bindValue ( $ key , $ value ) ; } $ sth -> execute ( $ params ) ; $ this -> executed [ ] = $ sql ; return $ sth ; }
Runs a SQL query with an array of placeholders
@param string $sql
@param array $params
@return \PDOStatement
Runs a SQL query with an array of placeholders