有php / MySQL派生的html表格单元格显示某些字符串,具体取决于MySQL列值

I have an html table built using php displaying MySQL data like so:

Current HTML Table (Displaying MySQL data)
SG # |  Customer | Required Date | Reject Value | Rev. Cat. | Reject Reason |

[#]  | [Cust. 1] |     [Date]    |    [$$$$]    |   [Data]  |      [#]      |
[#]  | [Cust. 1] |     [Date]    |    [$$$$]    |   [Data]  |      [#]      |
[#]  | [Cust. 1] |     [Date]    |    [$$$$]    |   [Data]  |      [#]      |

Right now, the column called "Reject Reason" has data pulled from a MySQL column "fault" that has a type of int (that was set up as a reference code - ex: 34 = "Damaged in Shipping"). So, when I reference that column, I get the number code returned. I want to set up some kind of an if statement to say:

if ([table].fault == '[a #]') {
  $rejectreason = "[Reason Corresponding to number]"
}
if.... So on and so forth for all possible returned numbers.

I then want to display the $rejectreason value in my html table so the reason corresponds with the fault value for that row.

I'm just not sure how to do this.

MY CODE:

    //SELECT statement to build table.
    $sql="SELECT invoices.id, clients.company, invoices.revenue, FORMAT(TRIM(LEADING '$' FROM invoices.totalprice), 2) as totalprice, invoices.requireddate, invoices.rej_value, invoices.fault 
    FROM invoices INNER JOIN clients ON invoices.clientid=clients.id
    WHERE ".$whereclause." 
    ORDER BY invoices.id DESC";

    //AND (invoices.requireddate BETWEEN '".$rejectfrom."' AND '".$rejectto."') 

    //SELECT statement to build table.
    //$sql2="SELECT company, revenue, id, TRIM(LEADING '$' FROM totalprice) AS totprice, requireddate, rej_value
    //  FROM invoices 
    //  WHERE ".$whereclause."
    //  GROUP BY ".$orderbyclause.""; 



  $result = $conn->query($sql);     
  //$result2 = $conn->query($sql2); 

    echo "<table id='rejectReport' align='center' class='report_DT'>
    <thead>
    <tr>


    <th>SG Number</th>
    <th>Customer</th>
    <th>Required Date</th>
    <th>Reject Value</th>
    <th>Revenue Category</th>
    <th>Reject Reason</th>
    </tr>
    </thead>";



    if ($result = $conn->query($sql)) {

            // fetch associative array 
            while ($row = $result->fetch_assoc()) {

                $rejectreason = "";


          //An attempt at solving this problem...
          /*
          if ($row['fault'] = '00') {
              $rejectreason = "No Code Currently Selected";
          }
          if ($row['fault'] = '10') {
              $rejectreason = "Broken (Equipment)";
          }
          if ($row['fault'] = '11') {
              $rejectreason = "Broken (Shipping)";
          }
          if ($row['fault'] = '20') {
              $rejectreason = "Scratches";
          }
          if ($row['fault'] = '21') {
              $rejectreason = "Bubbles";
          }
          if ($row['fault'] = '22') {
              $rejectreason = "Crazing";
          }
          if ($row['fault'] = '23') {
              $rejectreason = "Warp";
          }
          if ($row['fault'] = '24') {
              $rejectreason = "Burnout";
          }
          if ($row['fault'] = '30') {
              $rejectreason = "Broken (Worker)";
          }
          if ($row['fault'] = '31') {
              $rejectreason = "Slippage";
          }
          if ($row['fault'] = '32') {
              $rejectreason = "Dirty";
          }
          if ($row['fault'] = '33') {
              $rejectreason = "Incorrect Layup";
          }
          if ($row['fault'] = '34') {
              $rejectreason = "Incorrect Size";
          }
          if ($row['fault'] = '35') {
              $rejectreason = "Incorrect Assy";
          }
          if ($row['fault'] = '36') {
              $rejectreason = "Debris";
          }
         if ($row['fault'] = '40') {
              $rejectreason = "Other";
         }
          else {
              $rejectreason = "";
          }     
        */


        print_r($rejectreason); 


              echo "<tbody>";
              echo "<tr>";
              //echo "<td>" . $row['id'] . "</td>";
              if($row['id']) echo "<td><a href='../bms/workorders_addedit.php?id=".$row['id']. "' target='_SELF'>".$row['id']." </a></td>";
              echo "<td>" . $row['company'] . "</td>";
              echo "<td>" . $row['requireddate'] . "</td>";
              echo "<td>" ."$". $row['rej_value'] . "</td>";
              echo "<td>" . $row['revenue'] . "</td>";
              echo "<td>" . $row['fault'] . "</td>";
              }//end while.
              echo "</tr>";
              echo "</tbody>"; 


            /*
              while ($row = $result2->fetch_assoc()) {

                  echo "<tfoot class='report_DT'>
                        <tr>
                        <th>TOTALS: </th>
                        <th>$". $row['rpttotprice'] ."</th>
                        <th>". $row['rpttotsqft'] ."&nbsp;&nbsp;". "ft<sup>2</sup>"."</th>
                        <th>$". $row['rptavgsqftrev'] ."</th>
                        <th>". $row['rpttotqty'] ."</th>
                        <th>$". $row['rptavgunitrev'] ."</th>
                        </tfoot>
                        </table>";
              }//end while.
              */


 }//End table if.

All suggestions welcome.

Thank you!