codeigniter print query code example
Example 1: codeigniter print last sql query
print_r($this->db->last_query());
Example 2: codeigniter raw query
$sql="Select * from my_table where 1";
$query = $this->db->query($SQL);
return $query->result_array();
Example 3: how to print mysql query of codeigniter query builder
To display the query string:
print_r($this->db->last_query());
To display the query result:
print_r($query);