codeigniter echo last query
print_r($this->db->last_query());
5
2
We can get last executed query using last_query() function of db class in codeigniter. It is a very simple to use $this->db->last_query() function to see SQL statements of last executed query in php codeigniter app. You have to simple code that function after your main query that you wanted check
$this->db->last_query()
Thank you!
2
0
3.8
10
public function test_db(){ $query = $this->db->get("items"); $str = $this->db->last_query(); echo "<pre>"; print_r($str); exit;}
Thank you!
10
0
4.14
7
$this->db->last_query();
Returns the last query that was run (the query string, not the result). Example:
$str = $this->db->last_query();
// Produces: SELECT * FROM sometable....
Thank you!
7
0
Are there any code examples left?
New code examples in category PHP
-
PHP 2022-03-28 00:40:03 index:of curiosa 2019 mp4
-
PHP 2022-03-28 00:35:13 Dijkstra’s algorithm php
-
PHP 2022-03-28 00:35:12 get_declared_classes
-
PHP 2022-03-28 00:30:23 php move index of a value to first position in array
-
PHP 2022-03-28 00:25:01 wordpress get_date
-
PHP 2022-03-27 23:30:38 php shorten string with dots
-
PHP 2022-03-27 23:10:46 php header 500
-
PHP 2022-03-27 23:05:06 laravel schedule run
-
PHP 2022-03-27 22:25:12 Get page title, excerpt or content by id
-
PHP 2022-03-27 22:00:27 php convert date from dd/mm/yyyy to yyyy-mm-dd