How can I get the number of rows from a SELECT statement result set using the Advantage Database PHP Extension?
I ended up writing my own function that works similar to mysql_num_rows:
function my_num_rows($result) {
ob_start(); // begin disable output from ads_result_all
(int)$number = ads_result_all($result);
ob_end_clean(); //close and clean the output buffer
ads_fetch_row($r1, 0); // reset the result set pointer to the beginning
if ($number >= 0){
return $number;
} else {
return FALSE;
}
}
It could also be rewritten to count the rows using ads_fetch_row but this was easier for what I needed. With large result sets there could be slower performance using ads_result_all.