Tag : DB Statement


How to execute mysql query in laravel?

Sometimes, we require to run directly mysql query on Laravel for example if you need to copy one table to other table using mysql query. I also need in one project and that's why i am fetching problem. But you can use sql query on laravel using db statement in bellow example you can learn how to run. <strong>Example:</strong> <pre class="prettyprint lang-php"> DB::statement(" INSERT INTO `posts` (repost_of_id,token_id,post_details,user) SELECT id,token_id,post_details,".$loginUserId." FROM `posts` where id = ".$postId." "); </pre>

By Hardik Savani | May 2, 2016 | | 759 Viewer | Category : Laravel
READ MORE

    Laravel 5.3 - import export csv and excel file into database

    Laravel 5.3 - import export csv and excel file into database

    Open Post

    Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

    Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

    Open Post

    How to add charts in Laravel 5 using Highcharts ?

    How to add charts in Laravel 5 using Highcharts ?

    Open Post

    Simple Highcharts Chart Example using PHP MySQL Database

    Simple Highcharts Chart Example using PHP MySQL Database

    Open Post

    AngularJS - update bind ng-model input value from Jquery Code

    AngularJS - update bind ng-model input value from Jquery Code

    Open Post

    Ajax Image Upload Example with Validation in PHP Laravel Framework

    Ajax Image Upload Example with Validation in PHP Laravel Framework

    Open Post