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 | | 2849 Viewer | Category : Laravel
READ MORE

    How to create authentication(login and registration) in Laravel 5.2?

    How to create authentication(login and registration) in Laravel 5.2?

    Open Post

    jQuery Ajax X-editable bootstrap plugin to update records in PHP Example

    jQuery Ajax X-editable bootstrap plugin to update records in PHP Example

    Open Post

    PHP MySQL confirmation box before delete record using jquery ajax

    PHP MySQL confirmation box before delete record using jquery ajax

    Open Post

    How to create custom helper in Laravel 5?

    How to create custom helper in Laravel 5?

    Open Post

    Select box with search option example in Jquery using Chosen Plugin

    Select box with search option example in Jquery using Chosen Plugin

    Open Post

    Laravel 5 - Simple user access control using Middleware

    Laravel 5 - Simple user access control using Middleware

    Open Post