last query in ci

How to get last executed query in PHP Codeigniter?

Example:

public function AddMethodNameHere()
{
    $executeQQ = $this->db->get("your_table_name");
  
    $results = $this->db->last_query();
   
    echo "
";
    dump($results);
    exit;
}

Final Results:

SELECT * FROM `your_table_name`

Leave a Comment