I have two tables in SQL Server database. One table called matrix has all the values to display in a web table and the other table matrix-dropdowns have the values of the cells that have dropdowns. I want to have different background colors for the cell values of dropdowns in the web table, say if q1, then green color, if q2, yellow color. I could not figure out where to create a function to compare the cell values and return background color accordingly. The code snippet is shown below:
<?php
require_once('include/database.php');
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<section>
<table id="myTable" class="tablesorter">
<thead>
<tr>
<th>Capacity</th>
<th>Ownership</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$stmt = $conn->prepare("SELECT * FROM MATRIX ORDER BY OBJECTID ASC");
$stmt ->execute();
$result = $stmt->fetchAll();
foreach($result as $row) {
?>
<tr>
<td><?=$row['Ownership'];?></td>
<td><?=$row['Capacity'];?></td>
<td><a href="edit.php?id=<?=$row['OBJECTID'];?>">Edit </a> </td>
</tr>
</tbody>
<?php
}
?>