Codeigniter Print Last Sql Query

[Solved] Codeigniter Print Last Sql Query | Sql - Code Explorer | yomemimo.com
Question : codeigniter print last sql query

Answered by : real-rat-rqipzrtl3nxt

print_r($this->db->last_query()); 

Source : https://stackoverflow.com/questions/6142099/how-to-print-sql-statement-in-codeigniter-model | Last Update : Wed, 26 Aug 20

Question : codeigniter get last query

Answered by : moonis-abdi

$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.... 

Source : https://stackoverflow.com/questions/6536431/get-last-executed-query-in-mysql-with-php-codeigniter/6536500 | Last Update : Mon, 26 Oct 20

Question : print last executed db query codeigniter

Answered by : helpful-hamster-3su6x3w1lq4p

$this->db->last_query();

Source : | Last Update : Sat, 12 Sep 20

Question : print last query in codeigniter

Answered by : ankur-prajapati

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()

Source : | Last Update : Sat, 30 Jan 21

Question : echo last query in codeigniter 4

Answered by : shashanka-sharma

$this->db->getLastQuery()->getQuery()

Source : | Last Update : Tue, 20 Sep 22

Question : codeigniter echo last query

Answered by : real-rat-rqipzrtl3nxt

public function test_db(){ $query = $this->db->get("items"); $str = $this->db->last_query(); echo "<pre>"; print_r($str); exit;}

Source : https://www.itsolutionstuff.com/post/how-to-get-last-executed-query-in-php-codeigniterexample.html | Last Update : Sat, 09 May 20

Answers related to codeigniter print last sql query

Code Explorer Popular Question For Sql