Getting a Codeigniter Query Source

Using CodeIgniter’s framework for query binding is great but can make it hard to debug problems in your SQL statement. The solutions I have come up with is to use the compile_binds function. This will output your SQL statement after the parameters have been cleaned and added.

var_dump($this->db->compile_binds($sql, array($param1, $param2)));

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>