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 "

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.

Leave a Comment