Call to a member function real_escape_string() on null |
I'm facing this error in my model function:
Code: An uncaught Exception was encountered This is the function: PHP Code: public function getCompanyMessages($idCompany) The line 125 is PHP Code: $this->db->where($where); So I wrote an echo(var_export($where, true)); before this to get the content of $where array, and the content is just this: Code: array ( Why am I having this error and how to solve it? My environment is:
PHP Code: $active_group = 'default';
@thiago.bittencourt,
Why don't you have CI print the query so that you can see it. This way you can see what generated query is being run. Here is the link: (The function that you need is $this->db->get_compiled_select()) https://www.codeigniter.com/userguide3/d...cting-data
(05-29-2018, 12:36 PM)php_rocs Wrote: @thiago.bittencourt, I did it, and I got the query and ran in my MySQL editor, and it worked. So, to workaround this, I got the full query returned by $this->db->get_compiled_select() and ran into $this->db->query(): PHP Code: $query = $this->db->get_compiled_select(); And now it's working. |
Welcome Guest, Not a member yet? Register Sign In |