I am new in php. My goal is retrive data from csv or mysql and place them in a table in a certain formatting. I couldn't figure out how can I insert css sytles in php using conditional conditions such as
If ($dat1=="Monday"){...... cell color is red ????
If ($dat2>5){...... cell color is green ????
😕 Please help. Thanks a lot.
<body>
<table border="1" width="360" id="table1" style="border-collapse: collapse">
<td style="border-style: solid; border-width: 1px" align="center" width="60">
<font face="arial" size="-2"></font>
<?php
$fh = fopen("./data.csv", "r");
while (list($dat1, $dat2, $dat3, $dat4, $dat5, $dat6) = fgetcsv($fh, 1024, ",")) {
echo "
<tr>
<td>$dat1</td>
<td>$dat2</td>
<td>$dat3</td>
<td>$dat4</td>
<td>$dat5</td>
<td>$dat6</td>
</tr>";
}
?>
</td>
</body>
</html>