codeigniter print last query Examples

Today, We want to share with you codeigniter print last query.In this post we will show you codeigniter last insert id, hear for codeigniter echo last query we will give you demo and example for implement.In this post, we will learn about or where in codeigniter with an example.

Printing Last Executed Mysql Query in CodeIgniter?

codeigniter print last query - PHP
codeigniter print last query – PHP

the last_query() Function Returns the last query that was run (the query string, not the result).

Example 1: Last Query Function


codeigniter print last sql query

Example 2:


Example 3: Tamil_Logo.php


defined('BASEPATH') OR exit('No direct script access allowed');

class Tamil_Logo extends CI_Model {

    public function get_all_tamil_movies() {
        $result = $this->db->get("movies")->result();
        echo $this->db->last_query();
        return $result;


I hope you get an idea about print last query laravel.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  codeigniter last query (last query ci) Examples

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

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