PEAR DB is the database primitives shown earlier; it provides several
shortcut functions for fetching result rows, as well as a unique row ID system
and separate prepare/execute steps that can improve the performance of repeated
queries.
$com = $db->prepare(SQL);
$result_set = $db->query(SQL, values);
Pass the query( ) function SQL with in place of specific values, and add a second parameter consisting of the array of values to insert into the SQL
When issuing
the same query repeatedly, it can be more efficient to compile the query once
and then execute it multiple times, using the prepare( ) ,
execute( ), and executeMultiple( ) methods.
This returns a com query object. The execute( )
method fills in any placeholders in the query.
PEAR DB gives a lot of methods that perform a query and fetch the results
in one step:
$value-set = $db->getOne(SQL [, values ]);