in this code it looks like everything is ok but THE PROBLEM IS HERE
in this part of it the status is being displayed wrong when i reject a pirep it shows pending.
<?php
if(count($pireps) > 0)
{
foreach ($pireps as $pirep)
{
$pilotinfo = PilotData::getPilotData($pirep->pilotid);
$pilotid = PilotData::getPilotCode($pilotinfo->code, $pilotinfo->pilotid);
if($pirep->accepted == '0') $status = 'REJECTED';
if($pirep->accepted == '1') $status = 'ACCEPTED';
else $status = 'PENDING';
echo "<tr>";
echo "<td align=center bgcolor=#171717> $pirep->code-$pirep->flightnum </font></td>";
echo "<td align=center bgcolor=#171717> $pirep->depname </font></td>";
echo "<td align=center bgcolor=#171717> $pirep->arrname </font></td>";
echo "<td align=center bgcolor=#171717> $pilotid $pilotinfo->firstname $pilotinfo->lastname </font></td>";
echo "<td align=center bgcolor=#171717> $pirep->landingrate </font></td>";
echo "<td align=center bgcolor=#171717> $pirep->aircraft </font></td>";
echo "<td align=center bgcolor=#171717> $status </font></td>";
echo "</tr>";
}
}
else
{
echo "<tr><td><center>There are no recent flights!</td></tr></center>";
}
?>
</tbody>
</table>