![]() |
Call to a member function real_escape_string() on a non-object - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19) +--- Thread: Call to a member function real_escape_string() on a non-object (/showthread.php?tid=501) |
Call to a member function real_escape_string() on a non-object - bboom - 12-10-2014 When I use the load->database with the seccond param TRUE, I get the error Code: Severity: Error This happened after upgrade from codeigniter 2 to 3. I cannot find the problem in the upgrading guide. The code I use is: PHP Code: $ci =& get_instance(); RE: Call to a member function real_escape_string() on a non-object - _this - 12-11-2014 Hello bboom, Where is located the code you provided ? In a controller, a library, helper, core extension, ... ? RE: Call to a member function real_escape_string() on a non-object - bboom - 12-11-2014 This code is located in the constructor of the model. RE: Call to a member function real_escape_string() on a non-object - Narf - 12-11-2014 (12-10-2014, 03:01 PM)bboom Wrote: When I use the load->database with the seccond param TRUE, I get the error Is 'autoinit' set to TRUE for this database? If not, you must call db_connect() manually before executing any queries. RE: Call to a member function real_escape_string() on a non-object - bboom - 12-11-2014 That was the problem. I set autoinit to TRUE and it works. Thanks! RE: Call to a member function real_escape_string() on a non-object - Mdev - 09-02-2015 I have the same problem although i have the autoinit set. I needed to do this inside the Quote:C:\work\Codefi UI\codeigniter\system\database\drivers\mysqli\mysqli_driver.phpto make the error go away. Code: // -------------------------------------------------------------------- RE: Call to a member function real_escape_string() on a non-object - Narf - 09-02-2015 (09-02-2015, 09:47 AM)Mdev Wrote: I have the same problem although i have the autoinit set. DO NOT DO THIS! You're making yourself vulnerable to SQL injections! RE: Call to a member function real_escape_string() on a non-object - ciadvantage - 10-16-2017 I have same problem as today, kinda weird thing, in the database.php, I dont see the autoinit constanst , should i just simply added autoinit =>TRUE Many thanks RE: Call to a member function real_escape_string() on a non-object - biometrics - 01-31-2018 In our case this was caused by: $this->db->close(); Which we added to try to deal with a DDoS attack a few months ago. It didn't help but we left the code in there. Apache didn't seem to care about it but it was an issue when me migrated to Nginx. RE: Call to a member function real_escape_string() on a non-object - biometrics - 01-31-2018 (10-16-2017, 08:38 AM)ciadvantage Wrote: I have same problem as today, kinda weird thing, in the database.php, I dont see the autoinit constanst , should i just simply added We tried adding it but it made no difference. |