Я использую число c, чтобы сохранить статус моего отпуска в базе данных mysql. Если число равно 1, то отпуск утверждается, если число равно 2, то отпуск был отклонен. Теперь проблема, с которой я сейчас сталкиваюсь, заключается в том, что я не знаю, как преобразовать число c в строку, используя php. Я хочу, чтобы слово было одобрено и отклонено в файле .csv, который я экспортировал. Теперь показываются только цифры 1 и 2.
$query ="SELECT tblemployees.FirstName,tblemployees.LastName,tblemployees.EmpId,tblemployees.Gender,tblemployees.Phonenumber,tblemployees.EmailId,applyleave.id,applyleave.LeaveType,applyleave.FromDate,applyleave.duration,applyleave.ToDate,applyleave.descr,applyleave.PostingDate,applyleave.sta,applyleave.adminRemark,applyleave.AdminRemarkDate from applyleave inner join tblemployees on applyleave.employeeID=tblemployees.EmpId";
$result = mysqli_query($db, $query);
if(mysqli_num_rows($result) > 0)
{
$output .= '
<table class="table" bordered="1">
<tr>
<th>No</th>
<th>Employee ID</th>
<th>Employee Name</th>
<th>Employee Email</th>
<th>Employee Contact Number</th>
<th>Leave Type</th>
<th>From Date</th>
<th>To Date</th>
<th>Duration</th>
<th>Reason</th>
<th>Leave Status</th>
<th>Request Date</th>
<th>Admin Remark</th>
<th>Admin Remark Date</th>
</tr>
';
while($row = mysqli_fetch_array($result))
{
$sta='.$row["sta"].';
if($sta==1){
$status="Approved";
}
if($sta==2){
$status="Rejected";
}
$output .= '
<tr>
<td>'.$row["id"].'</td>
<td>'.$row["EmpId"].'</td>
<td>'.$row["LastName"].' '.$row["FirstName"].'</td>
<td>'.$row["EmailId"].'</td>
<td>'.$row["Phonenumber"].'</td>
<td>'.$row["LeaveType"].'</td>
<td>'.$row["FromDate"].'</td>
<td>'.$row["ToDate"].'</td>
<td>'.$row["duration"].'</td>
<td>'.$row["descr"].'</td>
<td>'.$status.'</td>
<td>'.$row["PostingDate"].'</td>
<td>'.$row["adminRemark"].'</td>
<td>'.$row["AdminRemarkDate"].'</td>
</tr>
';
}
$output .= '</table>';
header('Content-Type: application/xls');
header('Content-Disposition: attachment; filename='. date('Y-m-d') .' Leave Balance.xls');
echo $output;