Now, this is a useful little function. This allows you to grab the first column in the first row of data that a query returns. It is very useful for doing count functions or sum functions. It returns the value of the first column in the first row or an error object.
A typical use would be:
<?php $numrows = $db->getOne('SELECT count(*) FROM mystuff'); ?>
One nice thing about DB::getone is that it does the query, gets the results, and frees the results. No need to worry about cleanup with this function.
This is the general purpose query function. On failure it will return an error object. On success it will return either a DB_OK or a result set object. A DB_OK is a PEAR constant that just tells you the query executed successfully. You will receive a DB_OK for any query that executes properly that doesn't return a result set, i.e. an INSERT or UPDATE.
Usage for this function:
<?php $sql = "SELECT * FROM mystuff ORDER BY stuff"; $result = $db->query($sql); ?>