Escape raw SQL queries in Laravel 4

后端 未结 7 968
别那么骄傲
别那么骄傲 2020-12-15 16:23

How does one go about escaping parameters passed to a raw query in Laravel 4? I expected something like DB::escape() (which rings a bell from Laravel 3) and als

相关标签:
7条回答
  • 2020-12-15 16:40
    $value = Input::get("userID");
    
    $results = DB::select( DB::raw("SELECT * FROM users WHERE users.id = :value"), array(
       'value' => $value,
     ));
    

    More Details HERE

    0 讨论(0)
提交回复
热议问题