This is my data table1. I want this table change to as a table2. I have to use PHP for this. I wrote the some code using foreach but that is not working properly. C
Try this once i didn't check the output i am assuming array like follow
array(
[
"STUDENT_ID" => "1",
'MATHS' =>
array(
"EXAM_1" => 'test 1',
"EXAM_2" => 'test2'),
'ART' =>
array(
"EXAM_1" => 'test 1',
"EXAM_2"=> 'test2')
],
[
"STUDENT_ID" => "2",
'MATHS' =>
array(
"EXAM_1" => 'test 1',
"EXAM_2" => 'test2'),
'ART' =>
array(
"EXAM_1" => 'test 1',
"EXAM_2"=> 'test2')
]
);
`
$output .= "
SeqNo
Student Id
maths
art
";
$studentCounter = 0;
foreach($result as $item)
{
$output .= "" . ++$studentCounter . "
" . $item[STUDENT_ID] . "
" . $item[MATHS][EXAM_1] . "
" . $item[MATHS][EXAM_2] . "
" . $item[ART][EXAM_1] . "
" . $item[ART][EXAM_2] . " ";
"
}
$output .= "
";