Home · Latest · Trends  /  PHP
10

Adodb RecordCount( ) Examples

rated 10 times [  10] [ 0]  / comments: 0 / hits: 2320  / 3 years ago, thu, dec 1, 2016, 18:27:26
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;
 }
}
?>
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
 
Share
Snippets
Refresh html div content with jQuery
3 years ago, wed, dec 7, 2016
Getting a MySQL last MySQL id from an ADODB conn
3 years ago, thu, dec 8, 2016
Syntax code highlighting with JavaScript code prettifier for phpBB 3.2
3 years ago, thu, mar 2, 2017
Bootstrap 4 button remove focus outline border
2 years ago, thu, aug 3, 2017
Sponsor
Posted
Micky

Micky

Member since Nov 12, 2016
Total Code Snippets: 5
Total Comments: 2
Location: n/a
Following
User not following anyone yet.