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-statment a result resource handle
<?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 ?>
Deliver First Class Web Sites: 101 Essential Checklists Want to learn how to make your web sites usable and accessible? Want to ensure that your sites meet current best practice, without spending hours trawling through incomprehensible specifications and recommendations from dozens of different books, research papers, and web sites? Want to make sure that the sites you build are "right the first time," requiring no costly redevelopments?