last query in ci | get last query codeigniter Example

Today, We want to share with you last query in ci.In this post we will show you codeigniter last insert id, hear for Printing the query executed last by codeigniter framework using active record class we will give you demo and example for implement.In this post, we will learn about Join Query In Codeigniter Example Tutorial with an example.

How to print SQL statement in codeigniter model?

codeigniter last query
codeigniter last query

How To Get Last Query In PHP Codeigniter?

Example 1:

public function product()
    $query = $this->db->get("product");
    $str = $this->db->last_query();
    echo "<pre>";

Get the last executed Query in Codeigniter

Example 2:

$lastquery = $this->db->last_query();
echo $lastquery;

This will print the query in the format

/// SELECT * FROM products....

I hope you get an idea about get last query codeigniter 4.
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 *