public function query($select, $values = array(), $fetch = 'row')
    {
        if ($stmt = $this->prepare($select, $fetch)) {
            if ($this->prepared[$stmt]['type'] == 'SELECT' && $this->execute($stmt, $values)) {
                return $stmt;
            }
            $this->close($stmt);
        }

        return false;
    }
public function query($select, $values = array(), $fetch = 'row')
    {
        if ($stmt = $this->prepare($select, $fetch)) {
            if ($this->prepared[$stmt]['type'] == 'SELECT' && $this->execute($stmt, $values)) {
                return $stmt;
            }
            $this->close($stmt);
        }

        return false;
    }
public function query ( $ select , $ values = array ( ) , $ fetch = 'row' ) { if ( $ stmt = $ this -> prepare ( $ select , $ fetch ) ) { if ( $ this -> prepared [ $ stmt ] [ 'type' ] == 'SELECT' && $ this -> execute ( $ stmt , $ values ) ) { return $ stmt ; } $ this -> close ( $ stmt ) ; } return false ; }
Select data from the database.

@param string|array $select A SELECT statement.
@param string|array $values The query parameters.
@param string       $fetch  How you would like your row.

@return bool|int Either ``false`` if there was a problem, or a statement that you can ``$db->fetch($result)`` rows from.  Don't forget to ``$db->close($result)``.

```php
if ($result = $db->query('SELECT name, title FROM employees', '', 'assoc')) {
while ($row = $db->fetch($result)) {
print_r($row);
// array('name'=>'Roberto Cratchit', 'title'=>'CEO')
// array('name'=>'Raj Reddy', 'title'=>'Sysadmin')
// array('name'=>'Jason Bourne', 'title'=>'Janitor')
// array('name'=>'Jane Smith', 'title'=>'Sales Manager')
// array('name'=>'Rita Patel', 'title'=>'DBA')
// array('name'=>'John Smith', 'title'=>'Developer')
// array('name'=>'Ella Minnow Pea', 'title'=>'Executive Assistant')
}
$db->close($result);
}
```
Select data from the database .