how to join two table in codeigniter easily[updated] | ci_model | ci_controller | codeigniter 3 -datainflow
In this tutorial I am going to show you that how can you get the last executed query in laravel 5.While you are working on laravel application at that times , you may need to print last run query or if you want to check direct from phpmyadmin sql box, then this time it is needed.
I am going to showing you some example for that.
First one
We can get directly the current sql query using toSql() of laravel query builder.
$product= Product::where('product_id',1)->toSql(); print_r($product);
Second one
DB::enableQueryLog(); $product= Product::get(); $query = DB::getQueryLog(); print_r($query);
Here we need to enable query log for that.
Related posts