I'm trying to fetch a data in my database and put a condition in my table depends on the value of it.
<table class="tables" id="manageAppointTable" style="width:100%;">
<tr>
<th style="text-align: center;">Appoint ID</th>
<th style="text-align: center;">Appoint Date</th>
<th style="text-align: center; width: 150px">Item/s</th>
<th style="text-align: center;">Quantity</th>
<th style="text-align: center; width: 100px">Due Date</th>
<th style="text-align: center;">Appointment Status</th>
<th style="text-align: center;">Maintenance Status</th>
<th style="text-align: center;">Action</th>
</tr>
<?php
if ($num = mysqli_num_rows($run)>0) {
while ($result = mysqli_fetch_assoc($run)) {
echo "
<tr>
<td>".$result['appoint_id']."</td>
<td>".$result['order_date']."</td>
<td>".$result['item_type']."</td>
<td>".$result['quantity']."</td>
<td>".$result['due_date']."</td>
if($result["request_status"] == 1 ){
<td><label class='label label-danger'>Pending</label>".$result['request_status']."</td>;
} else {
<td><label class='label label-success'>Accepted</label>".$result['request_status']."</td>;
}
<td>".$result['appoint_status']."</td>
<td><a href='php_action/deleteAppoint.php?appoint_id=".$result['appoint_id']."' class='btn btn-sm btn-danger edit_cat' id='dltbtn'>Delete</a></td>
";
}
}
?>
</tr>
</table>
And this is the error i always get.
Parse error: syntax error, unexpected '"', expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\inventory-system\viewAppoint.php on line 42
The line 42 is if($result["request_status"] == 1 ){