如何根据一个参数更改从mysql填充的表上的行背景

Does anyone know how to change the row background depending on the data I get from MySQL database? This is my PHP which I then call in my html. I use datatables but I can remove them if theres the problem.

while($row = mysqli_fetch_array($result)) {

    if ($row['VRSTA'] == 1) echo '<tr style="background-color:#000000">';
    if ($row['VRSTA'] == 2) echo '<tr style="background-color:#ffff99">';
    if ($row['VRSTA'] == 3) echo '<tr style="background-color:#ff2f99">';

    echo "<tr>";
    echo "<td>" . $row['IME'] . "</td>";
    echo "<td>" . $row['PRIIMEK'] . "</td>";
    echo "<td>" . $row['EMAIL'] . "</td>";
    echo "<td>" . $row['TELEFON'] . "</td>";
    echo "<td>" . $row['KRAJ_DELOVANJA'] . "</td>";
    echo "<td>" . $row['STATUS_CLANA'] . "</td>";
    echo "<td>" . $row['DATUM'] . "</td>";
    echo "</tr>";
}

HTML:

<script>
    $(document).ready(function() {
        $.ajaxSetup({ cache: false }); 
        setTimeout(function() { 
            $('#mainResults').load('vse_prijave_php.php');
            setTimeout(function(){
            $('#mainResults').DataTable();
            },1000);
        }, 1000);
    });
</script>
<div id="results">
    <table border='1' id="mainResults">
        <td>Loading data ...</td>
    </table>
</div>

You must write on the tds, tr inline style may disabled. Or define class like tr.blabla td{} after than write to tr class variable.