What do I do to view a problematic SQL code? - 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: What do I do to view a problematic SQL code? (/showthread.php?tid=88635) |
What do I do to view a problematic SQL code? - owino - 10-09-2023 Back in the days of CI3 and even some early versions of CI4.x, whenever an SQL code is not working as I expect it to, I would have a look at it (on the browser) using 'echo' right where the SQL code is being applied in a model or somewhere near like in a library (after being returned by a method of a model). Now it seems 'echo' does not work at all - replaced with 'return' and and even then, on the browser, we only view the 'return' value of a controller method - not a model or a library. I don't mind if this apparent restriction is by design. My problem is that when I return an SQL code, the code is replaced with the following JSON object Code: {"db":{"DBDriver":"MySQLi","connID":{},"resultID":{},"protectIdentifiers":true,"escapeChar":"`","likeEscapeStr":" ESCAPE '%s' ","likeEscapeChar":"!","dataCache":[],"transEnabled":true,"transStrict":true,"deleteHack":true,"mysqli":{},"resultMode":0,"numberNative":false}} What do I do if I want to have a look at a problematic SQL code? RE: What do I do to view a problematic SQL code? - sammyskills - 10-09-2023 Depending on your query type, you can use one of the following: RE: What do I do to view a problematic SQL code? - owino - 10-09-2023 The problem is that I was using the return value of Code: getLastQuery() And I can view the SQL code by spewing it onto the browser at a library, and I believe even in a model. |