Query

Query -- Performing a query against a database.

Description

To perform a query against a database you have to use the function query(), that takes the query string as an argument. On failure you get a DB Error object, check it with DB::isError(). On succes you get DB_OK (predefined PEAR::DB constant) or when you set a SELECT-statment a DB Result object.

<?php
// Once you have a valid DB object...
$sql = "select * from clients";

$result = $db->query($sql);

// Always check that $result is not an error
if (DB::isError($result)) {
    die ($result->getMessage());
}
....
?>