CodeIgniter Forums
Call to a member function getResultArray() on false - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: Call to a member function getResultArray() on false (/showthread.php?tid=90997)



Call to a member function getResultArray() on false - warcooft - 06-02-2024

Hi @kenjis,
I used the MySQL and PostgreSQL database drivers to test the exact same query.

When running with MySQL there is no error issue, but when using PostgreSQL I get an error like the following:

[Image: S25iRX.jpg]

I'm currently using Codeigniter 4.5.1, on the previous version 4.4.8 that I used before there was no such error like that.
Thanks for advance.


RE: Call to a member function getResultArray() on false - kenjis - 06-03-2024

Check the actual SQL query and the result.


RE: Call to a member function getResultArray() on false - warcooft - 06-03-2024

i fixed the problem by separating the methods between get() and getResultArray();

example:
PHP Code:
$users $db->table('users')->get();

if(
$users) { // check if true do something
    dd($users->getResultArray());



but i don't know why above case only happens when using PostgreSQL?


RE: Call to a member function getResultArray() on false - kenjis - 06-03-2024

Check the actual SQL query.
See https://codeigniter.com/user_guide/testing/debugging.html#logging-all-sql-queries


RE: Call to a member function getResultArray() on false - warcooft - 06-03-2024

Ok, I will check it. If I apply the event in production mode does it affect the application performance significantly?