Thu, December 2, 2021
 
https://devcodepro.comdevcodepro
X
InterServer Web Hosting and VPS
Home · Latest · Trends
11

Adodb RecordCount( ) Examples

Count number of rows in the record set
<?php
//example 1
$ra = $DB->execute('SELECT * FROM articles WHERE id = '.$DB->qstr($id).'');
if(!$ra)
 print $DB->ErrorMsg();
else
 while(!$ra->EOF) {
  $numrows = $ra->PO_RecordCount();
  echo $numrows;
  //$title = $ra->fields['title'];
  $ra->MoveNext();
 }
?>

<?php
//example 2
$ra = $conn->Execute('SELECT * FROM articles WHERE id = '.$DB->qstr($id).'');
if($ra) {
 if($ra->fields > 0) {
  $numrows = $ra->PO_RecordCount("articles");
  echo $numrows;
 }
}
?>
rated 11 times (11) (0)
comments: 0 / hits: 4020  / 5 years ago, thu, dec 1, 16, 06:27:26
More From » PHP
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
Login with Google
 
Share
Posted
Micky
Member since Nov 12, 2016
Total Code Snippets: 5
Total Comments: 2
Location: n/a
Micky snippets
5 years ago, wed, dec 7, 16, 12:37:43
comments: 0 / hits: 5334
5 years ago, thu, dec 8, 16, 6:21:29
comments: 1 / hits: 9826
PHP
5 years ago, thu, mar 2, 17, 6:35:12
comments: 0 / hits: 9666
4 years ago, thu, aug 3, 17, 2:59:59
comments: 0 / hits: 13960
CSS