CodeIgniter Forums
Printing $this->db->query() result problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Printing $this->db->query() result problem (/showthread.php?tid=48332)



Printing $this->db->query() result problem - El Forum - 01-12-2012

[eluser]veledrom[/eluser]
Code:
$data['db_resultset'] = $this->db->query("SELECT * FROM .....");
OR
$data['db_resultset'] = "String message";

Code:
$result_set = $db_resultset->result();
If I use line above in view I get error: Fatal error: Call to a member function result() on a non-object in....

What I need in my view is something like this:
Code:
if(is_array($result_set))
{
  print_r($result_set);
}
else
{
  echo $result_set;
}

I tried but is_array() doesn't work.

Thanks in advance