Introduction - Connect Introduction - Fetch

MDB

PEAR Manual


Introduction - Query

Introduction - 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 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



<?php

// 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 (
$result->getMessage());

}



// Continue on with your script

?>


Introduction - Connect Introduction - Fetch

MDB

PEAR Manual