I have code , and I need to change color row when in last column 'status' appears value = 'error'
<?php
//first, get the file...
$file = file('log.txt');
//now count the lines ..
$lines = count($file);
//start the table here..
echo '</br>';
echo'<table border="1" width="600">';
echo ' <td width="400">Date</td>';
echo ' <td width="300">Name</td>';
echo ' <td width="400">Status</td>';
//start the loop to get all lines in the table..
for ($i=0; $i<=$lines; $i++) {
//get each line and exlplode it..
$part = explode(';', $file[$i]);
//now start printing ..
echo'<tr>
<td width="400">'.$part[0].'</td>
<td width="300">'.$part[1].'</td>
<td width="400">'.$part[2].'</td>
</tr>';
}
//close the table so HTML wont suffer :P
echo'</table>';
?>
I change this :
If ($part[2] == 'error')
{
echo '<td width="400" bgcolor="red">'.$part[2].'</td>';
}
else
{
echo '<td width="400" bgcolor="green">'.$part[2].'</td>;
}
but this did not work - no color change in row
someone has an idea how to improve?