I've attempted various solutions, however, it still doesn't seem to be working. I am attempting to present data from a database in a table using the jQuery DataTables plugin. Everything appears to be correct technically, but the background color of some rows isn't displaying. What could be causing this issue?
<html lang="pl">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<title>Football stats</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
<script>
$(document).ready(function(){
$('#table1').DataTable();
});
</script>
</head>
<?php
$connection = new mysqli('localhost','root','','matches');
$sql = 'MY SELECT';
$result = $connection->query($sql);
echo '<body>
<table id="table1">
<thead>
<tr>
<th>ID</th>
<th>Hour</th>
<th>Country</th>
<th>Team</th>
<th>Ov 2,5</th>
<th>Avg</th>
<th>Ov 1,5ht</th>
<th>LG HT</th>
<th>LG FT</th>
<th>LG</th>
<th>EOver</th>
<th>EAvg</th>
<th>EOvHT</th>
<th>EHt</th>
<th>EFt</th>
<th>ELate</th>
<th>SUMAvg</th>
<th>H2HOver</th>
<th>H2HGAvg</th>
<th>H2HOvHt</th>
</tr>
</thead>';
echo '<tbody>';
while (($record = $result -> fetch_assoc()) != null)
{
$explode = explode("/", $record['home']);
echo '<tr>';
echo '<td>'.$record['id_match'] . '</td>';
echo '<td>'.$record['hour'] . '</td>';
echo '<td>'.$explode[2] . '</td>';
echo '<td>'.$explode[3] . '</td>';
echo '<td>'.$record['over'] . '</td>';
echo '<td>'.$record['goalsavg'] . '</td>';
echo '<td>'.$record['overht'] . '</td>';
echo '<td>'.$record['lategoalht'] . '</td>';
echo '<td>'.$record['lategoalft'] . '</td>';
echo '<td>'.$record['lategoal'] . '</td>';
echo '<td>'.$record['EOver'] . '</td>';
echo '<td>'.$record['EAvg'] . '</td>';
echo '<td>'.$record['EOvHT'] . '</td>';
echo '<td>'.$record['EHt'] . '</td>';
echo '<td>'.$record['EFt'] . '</td>';
echo '<td>'.$record['ELate'] . '</td>';
echo '<td>'.$record['SUMAvg'] . '</td>';
echo '<td>'.$record['H2HOver'] . '</td>';
echo '<td>'.$record['H2HGAvg'] . '</td>';
echo '<td>'.$record['H2HOvHt'] . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
?>
Here's an example of how it should look: https://datatables.net/examples/basic_init/zero_configuration.html
The rows in my table are not being highlighted as expected..