Hello! I am a beginner student, and I have a problem. I would like to write the order items' status. This code works, so if the order status = 0 the program writes "waiting", else writes "delivered". But what if I would like to add one more status (for example "shipping") then how can I do that? Because I cannot use code this way: while ($record = mysqli_fetch_assoc($table)) { $status= $record["rstatus"] == 0 ? "waiting" : "delivered"; I tried the if else code, when the order status=0 write "waiting", if else order status=1 write "shipping", else write "delivered" but it does not work or I wrote wrong.
(I hope you understand my English. This is not my native language)
<?php
require_once("header.php");
if (isset($_SESSION["auid"])) {
?>
<div class="container">
<h1 class="text-center">Orders</h1>
<table width="100%">
<tr style="font-weight: bold;">
<td>Order number</td>
<td>Date</td>
<td>Payment</td>
<td>Order status</td>
<td> </td>
</tr>
<?php
while ($record = mysqli_fetch_assoc($table)) {
$status= $record["rstatus"] == 0 ? "waiting" : "delivered";
$icon = $record["rstatus"] == 0 ? "glyphicon-ok" : "glyphicon-time";
$color = $record["rstatus"] == 0 ? "text-danger" : "";
?>
<tr class="<?php print $color; ?>">
<td><a class="btn btn-link" style="padding-left: 0px;" data-toggle="modal" data-target="#OrderItemsModal" onclick="OrderItemsList(<?php print $record["rfid"]; ?>)"><?php print $record["rfordernumber"]; ?></a></td>
<td><?php print $record["rfdate"]; ?></td>
<td><?php print $record["fname"]; ?></td>
<td><?php print $status; ?></td>
<td><a class="btn btn-link" href="index.php?rfid=<?php print $record["rfid"]; ?>"><span class="glyphicon <?php print $ikon; ?>"></span></a></td>
</tr>
<?php
}
?>
</table>
</div>
<?php
}
require_once("footer.php");
Quick Edit