我试图按第3列(日期列)对数据表进行排序,但是它似乎只按日期列中的第1个数字排序,如下图所示。我如何才能按日期而不是数字排序?
echo "<table>
<thead>
<th>Zone</th>
<th>Popularity</th>
<th>Date</th>
</thead>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['location'] . "</td>";
echo "<td>" . $row['count(location)'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "</tr>";}
echo "</table>";
mysqli_close($con);
?>
<script>
$('table').DataTable( {
dom: 'Bfrtip',
"order": [[ 2, "desc" ]],
buttons: [
'copy',
{
extend: 'csv',
text: 'CSV',
extension: '.csv',
exportOptions: {
modifier: {
page: 'current'
}
},
title: 'table'
},
'pdf',
'print', ],
} );
</script>