錯誤所以我有這樣的代碼
$Input = Input::all();
$makethis = Input::flash();
$soptions = Input::get('soptions');
$items = Gamefarm::where('roost_hen', '=',Input::get('sex'))
->where('bname', 'LIKE', '%$soptions%')
->paginate(6);
我想要做的就是laravel接受$soptions
內的值。當我嘗試硬編碼$soptions
它工作正常。
UPDATE:
一個問題
$Input = Input::all();
$makethis = Input::flash();
$textbox = Input::get('searchbox');
$soptions = Input::get('soptions');
var_dump($soptions);
$items = Gamefarm::where('roost_hen', '=', Input::get('sex'))
->where($soptions, 'LIKE', "$textbox")
->paginate(6);
return View::make('gamefarms/index', compact('items','makethis'));
現在我要做的是使用變量$soptions
要查詢的字段名,我得到一個錯誤500,當我做到這一點
使用雙引號,而不是單引號。或連接。 – ceejayoz 2014-12-11 05:48:54
如果您有第二個問題,最好在網站上發佈新問題。 – msturdy 2014-12-11 06:38:05
是的,我知道,但我真的需要現在解決這個問題。對不起 – 2014-12-11 06:43:53