CodeIgniter Forums
Connect to db2 from pdo no results v.2.2.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Connect to db2 from pdo no results v.2.2.0 (/showthread.php?tid=60714)



Connect to db2 from pdo no results v.2.2.0 - El Forum - 06-10-2014

[eluser]Unknown[/eluser]
I'm trying to show results of a query, the db2 connection to work properly,
but send me the following error when I run the query:
Fatal error: Call to a member function rowCount () on a non-object in
database / drivers / pdo / pdo_result.php on line 42.



I think that this error had been fixed in version 2.1.1 but the upgrade to version 2.2.0 returned.

Code:
public function num_rows()
{
  if (is_int($this->num_rows))
  {
   return $this->num_rows;
  }
  elseif (($this->num_rows = $this->result_id->rowCount()) > 0) //line 42
  {
   return $this->num_rows;
  }

  $this->num_rows = count($this->result_id->fetchAll());
  $this->result_id->execute();
  return $this->num_rows;
}



Connect to db2 from pdo no results v.2.2.0 - El Forum - 06-10-2014

[eluser]Tpojka[/eluser]
Maybe there is conflict in functions/methods name. Try to call it this way:
Code:
public function num_rows2(){/*code here*/}