dragosmocrii at gmail dot com:
It is slightly more efficient to use the COUNT function. (And when I say slightly I mean whisker small slightly.)
<?php
// $db is a SQLite database connection
if (sqlite_single_query($db, 'SELECT COUNT(*) FROM records WHERE amount_owing > 500')) {
// There are records where the amount owing exceeds $500, do some action.
} else {
// No money for you!
}
?>