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:
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.
I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I’m a full-stack developer, entrepreneur and owner of Pakainfo.com. 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.