Escape raw SQL queries in Laravel 4

后端 未结 7 1009
别那么骄傲
别那么骄傲 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:24

    You may also try this, (Read Documentation)

    $results = DB::select('SELECT * FROM users WHERE users.id = ?', array($userId));
    

提交回复
热议问题