PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, October 28, 2022

[FIXED] how to check if ADOdb recordset is empty

 October 28, 2022     adodb-php, is-empty, recordset, testing     No comments   

Issue

I ran into the problem while checking emptiness of the ADODB5 recordset

$db = ADONewConnection($dbdriver);
$db->Connect($dbhost, $dbuser, $dbpass, $dbname);
$rs = $db->Execute($query);

now, if I try to check recordset

if(isset($rs[0]))
...
...

I get the error Cannot use object of type ADORecordSet_mysqli as array

How do you check whether returned recordset is or isn't empty?


Solution

before isset evaluation I converted ADODB recordset to array

$ra = $rs->getRows();

then tested if $ra array is empty

if(empty($ra)){
...
...
}


Answered By - m1k3y3
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing