mercredi 20 janvier 2021

if statement in a foreach loop based on the value of a column to set font color of a row php mysql?

I am trying to set the font color of a row based on a value in column LLstatus. I have tried many times and cannot get it to work, please help what am I doing wrong, here is my code

<?php
include 'database.php';
$pdo = Database::connect();
$sql = 'SELECT * FROM De_Lijst WHERE Positie<76 ORDER BY Positie';
foreach ($pdo->query($sql) as $row) {
        
    if ($row['LLstatus'] == "Nieuw"){$color = "#ffff00" }

    echo '<tr class="table-row"data-   href="trackinfo.php?DB_ID='.$row['DB_ID'].'">';
    // echo '<td style="align: center;">'. $row['LLstatus'] . '</td>';
    echo '<td>'. $row['Positie'] . '</td>';
    echo '<td>'. $row['Artiest'] . '</td>';
    echo '<td>'. $row['Titel'] . '</td>';
    // echo '<td>'. $row['Duur'] . '</td>';
    // echo '<td width=75 style="background: #0e0e0e; align: center;">';
    // echo '&nbsp&nbsp&nbsp<a class="btn btn-primary btn-sm" href="trackinfo.php?DB_ID='.$row['DB_ID'].'">Info</a>';
    // echo ' ';
    echo '</tr>';
}
Database::disconnect();
?>

Aucun commentaire:

Enregistrer un commentaire