doCount() is used the same as doSelect(), but it counts the rows instead of selecting them and returns the number of rows that match the query.



require_once('config.php');

//Create new instance of Query
$q = new Query;

//Add search criteria
$q->add('Author',$_POST['Author']);

//Count all the books from the database that match the query criteria
$bookCount = Book::doCount($q);

//Print the number of books that match the search criteria
echo "$bookCount books match your search criteria.";
?>

(503) 746-9116 | 17933 NW Evergreen Parkway, Suite 220 | Beaverton, Oregon 97006