Database query: number of rows returned?

Permalink 1 user found helpful
Building my own PHP scripts to go into a custom block. What's the 'correct' method to find the number of rows returned from a query. Have looked in what I think is the database abstraction file (concrete/libraries/database.php), but it seems very minimal.

hockeyshooter
View Replies:
Mnkras replied on at Permalink Reply
Mnkras
concrete5 uses ADODB, when you get the rows you can do

while($row = $r->FetchRow()) {
    print_r($row);
}
mkly replied on at Permalink Reply
mkly
$myvalue = 25;
// this gets us the database object
$db = Loader::db();
// adodb query with binding to escape
// variable
$rs = $db->Execute('SELECT somevalue FROM sometable WHERE something=?', array($myvalue));
// This gives us the count
// or -1 for none;
// can also use RowCount()
$count = $rs->RecordCount();