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 success you get
DB_OK or
when you set a SELECT-statment a
DB_Result object.
Example 20-1. Doing a query | <?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());
}
....
?> |
|