title: How to print SQL statement in codeigniter model
body: <p>I have a sql statement in my model,</p>
  
  <p>I then say</p>
  
  <pre><code>$query = $this-&gt;db-&gt;query($sql, array(fields, fields1);
  
  if ($query) {
      return true:
  } else {
      echo "failed";
      return false;
  }
  </code></pre>
  
  <p>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</p>