CodeIgniter Forums
Query single result - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Query single result (/showthread.php?tid=66645)



Query single result - superior - 11-15-2016

Hello,

In CI 3 you could just do a call like $this->db->get()->result() to retreive a single result on where clause. But in CI 4 this is not available anymore (or think so) is there anyway to do this?


RE: Query single result - enlivenapp - 11-15-2016

(11-15-2016, 12:34 PM)superior Wrote: Hello,

In CI 3 you could just do a call like $this->db->get()->result() to retreive a single result on where clause. But in CI 4 this is not available anymore (or think so) is there anyway to do this?
I'm on my phone so please excuse the brevity. 

$db->get()->getResultArray();. //or similar. 

Method chaining is explained in the CI4 docs


RE: Query single result - superior - 11-16-2016

(11-15-2016, 07:44 PM)enlivenapp Wrote:
(11-15-2016, 12:34 PM)superior Wrote: Hello,

In CI 3 you could just do a call like $this->db->get()->result() to retreive a single result on where clause. But in CI 4 this is not available anymore (or think so) is there anyway to do this?
I'm on my phone so please excuse the brevity. 

$db->get()->getResultArray();. //or similar. 

Method chaining is explained in the CI4 docs

Got it in another way, but thank you for the feedback!