Skip to content
Advertisement

How to print SQL statement in codeigniter model

I have a sql statement in my model,

I then say

JavaScript

My query always fails, how do I get php to print the exact sql statement being sent to my database? And display that on my php view, page

Advertisement

Answer

To display the query string:

JavaScript

To display the query result:

JavaScript

The Profiler Class will display benchmark results, queries you have run, and $_POST data at the bottom of your pages. To enable the profiler place the following line anywhere within your Controller methods:

JavaScript

Profiling user guide: https://www.codeigniter.com/user_guide/general/profiling.html

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement