I have a table that stores subjects offered and a table that stores the results scored by the students in an exam, in displaying the results using a view table, I want the system to display a (-) where a student does not take that subject and a score where he is taking the subject.
The sample array of the subjects stored is:
Array (
[0] => stdClass Object ( [subCode] => 101 [subName] => English )
[1] => stdClass Object ( [subCode] => 102 [subName] => Kiswahili )
[2] => stdClass Object ( [subCode] => 121 [subName] => Mathematics )
[3] => stdClass Object ( [subCode] => 231 [subName] => Biology )
[4] => stdClass Object ( [subCode] => 232 [subName] => Physics )
[5] => stdClass Object ( [subCode] => 233 [subName] => Chemistry )
[6] => stdClass Object ( [subCode] => 311 [subName] => History )
[7] => stdClass Object ( [subCode] => 312 [subName] => Geography )
[8] => stdClass Object ( [subCode] => 313 [subName] => CRE )
[9] => stdClass Object ( [subCode] => 443 [subName] => Agriculture )
[10] => stdClass Object ( [subCode] => 565 [subName] => Business Studies ) )
The array that contains results of the student to display is:
Array ( [0] => stdClass Object ( [admNo] => 2129 [subCode] => 101 [score] => 78 ) [1] => stdClass Object ( [admNo] => 2129 [subCode] => 102 [score] => 80 ) [2] => stdClass Object ( [admNo] => 2129 [subCode] => 121 [score] => 70 ) [3] => stdClass Object ( [admNo] => 2129 [subCode] => 231 [score] => 76 ) [4] => stdClass Object ( [admNo] => 2129 [subCode] => 233 [score] => 76 ) [5] => stdClass Object ( [admNo] => 2129 [subCode] => 311 [score] => 85 ) [6] => stdClass Object ( [admNo] => 2129 [subCode] => 313 [score] => 90 ) [7] => stdClass Object ( [admNo] => 2129 [subCode] => 565 [score] => 80 ) [8] => stdClass Object ( [admNo] => 4093 [subCode] => 101 [score] => 60 ) [9] => stdClass Object ( [admNo] => 4093 [subCode] => 102 [score] => 70 ) [10] => stdClass Object ( [admNo] => 4093 [subCode] => 121 [score] => 85 ) [11] => stdClass Object ( [admNo] => 4093 [subCode] => 231 [score] => 80 ) [12] => stdClass Object ( [admNo] => 4093 [subCode] => 232 [score] => 80 ) [13] => stdClass Object ( [admNo] => 4093 [subCode] => 233 [score] => 80 ) [14] => stdClass Object ( [admNo] => 4093 [subCode] => 312 [score] => 95 ) [15] => stdClass Object ( [admNo] => 4093 [subCode] => 565 [score] => 86 ) )
I need a solution where the view displays a (-) where the subcode in the subjects array is not found in the results array.