last query ci – codeigniter last query Example

Today, We want to share with you last query ci.In this post we will show you codeigniter print last query, hear for Codeigniter 4 get last query we will give you demo and example for implement.In this post, we will learn about select Query In Codeigniter Example Tutorial with an example.

PHP Codeigniter get last executed query example

Add or adapt the following line of code into your controller or model:

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

Example 1: Get the last executed query

$sql = $this->db->last_query();

Finding the last database query

public function group_list($id)
{
    $this->db->select('*'); 
    $this->db->where('id',$id); 
    $query = $this->db->get("group_list")->result();
    echo $this->db->last_query(); die;
}

Output

select * from group_list where id=10

I hope you get an idea about print last query in codeigniter.
I would like to have feedback on my infinityknow.com 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