2017-08-05 28 views
0

我使用Session ::把()laravel但蔭收到錯誤,如何把laravel中的Session與不同的數據庫放在一起?

錯誤選擇了兩個數據庫,爲1用於數據系統中的兩個和我有一個選擇的選擇,我想獲取會話

ErrorException在Grammar.php線102:)傳遞給 照亮\數據庫\語法:: columnize(參數1必須是類型陣列,給定的字符串 ,稱爲在 的C:\ xampp5.6 \ htdocs中\ larasimak \ vendor \ laravel \ framework \ src \ Illuminate \ Database \ Query \ Grammars \ Grammar.php on line 105 and defined

這個代碼

$tahun= Session::put('tahun', DB::connection('pgsql2')->table('laporan')->get('tahun')); 
$bulan=Session::put('bulan', DB::connection('pgsql2')->table('laporan')->get('bulan'));;  
$tahun2=Session::put('tahun2', DB::connection('pgsql2')->table('laporan')->get('tahun2'));; 
$bulan2=Session::put('bulan2', DB::connection('pgsql2')->table('laporan')->get('bulan2'));; 
$audit1 = Session::put('audit1', DB::connection('pgsql2')->table('laporan')->get('audit1'));; 
$audit2 =Session::put('audit2', DB::connection('pgsql2')->table('laporan')->get('audit2'));; 

我讀過的人使用的Session 2 PARAM但還是我'得到錯誤。我該如何解決 ?

+0

你想用'得到( 'tahun')' – C2486

+0

@Rishi我把查詢然後在數據表'$ sql_TotalAsetLancar = DB ::連接顯示它(」做什麼AND(audited = $ audit1)「);'選擇SUM(nilai)總共FROM laporan WHERE tahun ='$ tahun'AND bulan ='$ bulan'AND parentgrup = '10' – Aslam

回答

0

get()函數需要一個列名稱數組。你正在傳遞一個字符串。

->get('tahun')應該->get(array('tahun'))

相關問題