Quote: I have data value from 2 years which is 2021 and 2022 with same staff_id. I have display all data from year 2022(Now) and how do I get data from year 2021 with same staff_id but different application_id and different year_id.I give a simple example according to my problems. The problem is how to get value for third 'td' which is the answer in from data value 2022?
<table> <tr> <th> Staff Name </th> <th> Score Year 2021 </th> <th> Score Year 2022 </th> </tr> <tr> <td>Mimi</td> <?php foreach ($scoreYear as $key => $value){ if (array_key_exists($key,$value['assessment'])){ echo '<td>'.$value['assessment'][$key]['score_a'].'</td>'; echo '<td>'.$value['assessment'][$key]['score_a'].'</td>'; } } ?> </tr> </table>
$filter['year'] = date('Y'); $scoreYear = array(); $mySQL = 'SELECT id, year_assessment FROM assessment_year WHERE type_assessment = "Performance Assessment" AND year_assessment = "'.$filter['year'].'"'; $result = mysql_query($mySQL); if (mysql_num_rows($result) > 0){ while ($row = mysql_fetch_assoc($result)){ $scoreYear [$row['id']] = $row['year_assessment']; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)