Introduction - Query

Introduction - Query – Performing a query against a database.


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 MDB_Error object. Be sure to check it with MDB::isError(). On success, you get MDB_OK or when you set a SELECT-statement a result resource handle

A simple MDB query

// Once you have a valid MDB object...
$sql "select * from clients";

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

// Always check that $result is not an error
if (MDB::isError($result)) {
    die (

// Continue on with your script
Connecting and disconnecting a database (Previous) Fetching rows from the query (Next)
Last updated: Tue, 24 Nov 2015 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.