laravel query db::raw
snippet in php

laravel query db::raw

user9253

$someVariable = Input::get("some_variable");

$results = DB::select( DB::raw("SELECT * FROM some_table WHERE some_col = '$someVariable'") );

DB::table('users')->get();

user412

DB::select('SELECT * FROM users WHERE name = ?', array(Input::get('name')));

DB::table('users')->get();

user5674

DB::select('SELECT * FROM users WHERE name = "'.Input::get('name').'"');