2015-06-13 10:17:52
0
I am using Laravel 4.2. I have two mysql tables OwnTable, OtherTable. I am getting values successfully from these tables through php.
My further PHP code look like below to display values in blade php,
if (!empty ($OwnTable)){
foreach($OwnTable as $owntbl){
$Finalvalue['OwnValue']['Name'] = $owntbl->Name;
}
}
if (!empty ($OtherTable)){
foreach($OtherTable as $othertbl){
$Finalvalue['OtherValue']['Name'] = $othertbl->Name;
}
}
$myData = array('Finalvalue' => $Finalvalue);
if(.....) {
return View::make('display')->with('myData', $myData);
}
And the code in display.blade look like below,
@foreach($myData['Finalvalue'] as $res)
{{{$res['OwnValue']['Name']}}}{{{$res['OtherValue']['Name']}}}@endforeach
When I try to run the code, it gives an error 'Undefined index: OwnValue'.
I am sure I am doing some mistakes in array Handling. I am not so much talent in array handling. Highly appreciate if anyone suggest me in this. Thanks :-)