0

all I want to do is to color the font total stocks red if the total stocks is below minimum inventory level but it gives me this error Parse error: syntax error, unexpected token "if" in C:\xampp\htdocs\inventory-management-system\model\item\itemDetailsSearchTableCreator.php on line 42 kindly help. thanks

this is my code

// Create table rows from the selected data
while($row = $itemDetailsSearchStatement->fetch(PDO::FETCH_ASSOC)){
    $stock = $row['stock'];
    $reserved = $row['reserved'];
    $minimumStockLevel = $row['minimumStockLevel'];
    $totalStocks = $stock + $reserved;

    
    $output .= '<tr>' .
                    '<td>' . $row['productID'] . '</td>' .
                    '<td>' . $row['itemNumber'] . '</td>' .
                    '<td><a href="#" class="itemDetailsHover" data-toggle="popover" id="' . $row['productID'] . '">' . $row['itemName'] . '</a></td>' .
                    '<td>' . $row['minimumStockLevel'] . '</td>' .
                    '<td>' . $row['stock'] . '</td>' .
                    '<td>' . $row['reserved'] . '</td>' .

                    if($row['minimumStockLevel']>'$totalStocks') 
     echo "<td style='background-color: #00FF00;'>".$totalStocks."</td>"; 
                    '<td>' . $row['unitPrice'] . '</td>' .
                    '<td>' . $row['status'] . '</td>' .
                    '<td>' . $row['description'] . '</td>' .
                '</tr>';
}
meaaann
  • 3
  • 2

0 Answers0