I have a table that, time value is negative, and time is positive. I would like these values to be green or red. But I could not do that. Currently my select is being rendered this way:
(php, myadmin, pdo)
<?php
$sql = $pdo->prepare("SELECT sum(premio) as premio from home
WHERE id_user = :id_user;");
$sql->bindValue(":id_user", $id);
$sql->execute();
if ($sql->rowCount() > 0) {
foreach ($sql->fetchAll() as $item) {
?>
<tr>
<th>Ganho</th>
<td> R$ <?php echo $item['premio'];?></td>
</tr>
<?php
}
}
?>