CodeIgniter Forums

Full Version: Codeigniter 4 get last query
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can i  print the last query in a view ?
PHP Code:
// controller
$data['lastQuery'] = $db->getLastQuery();

// view
<?= $lastQuery?>

if you need to do all of this in the view you would need and instance of the database connection
and model.