$header = DB::select("SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tableOne'");
$secheader = DB::select("SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tableTwo'");
$variables = DB::table('tableThird')->get();
$variables = json_decode(json_encode($variables, true));
$tbHeading = json_decode(json_encode($header, true)); //json object
return view('admin/crosstabdata', compact('secheader','tbHeading','variables'));
When I print all three variables to view (crosstabdata.blade.php
) file, it said:
secheader variable does not exist.