Tabela danych, pogrupowane / Podzielone według daty

0

Pytanie

Mam tabela MySQL

ID Data Nazwa Pliki
1 2021-10-11 12:00:00 OG Loc Boże, Rap
2 2021-10-11 12:00:00 Ryder Boże, Jak Jesteśmy Zmęczeni
3 2021-10-10 12:00:00 Carl Dziecko Boże
4 2021-10-10 12:00:00 Johnson Boże, Lie
5 2021-10-10 12:00:00 Ogromny Dym Boże, Pęknąć!
6 2021-10-9 12:00:00 Słodki Boże, Brat

Chcę zarchiwizować dane wydrukowane za pomocą PHP w tabeli i oddzielone / pogrupowane według daty:

# Bilet(dowód tożsamości) Data Nazwa Pliki
2021-10-11
1 1 2021-10-11 12:00:00 OG Loc Boże, Rap
2 2 2021-10-11 12:00:00 Ryder Boże, Jak Jesteśmy Zmęczeni
2021-10-10
3 3 2021-10-10 12:00:00 Carl Dziecko Boże
4 4 2021-10-10 12:00:00 Johnson Boże, Lie
5 5 2021-10-10 12:00:00 Ogromny Dym Boże, Pęknąć!
2021-10-09
6 6 2021-10-9 12:00:00 Słodki Boże, Brat
html php
2021-11-24 05:46:14
1

Najlepsza odpowiedź

0
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body class="container mt-2">

<?php
$date=array();
$cars = array("2021-04-25","2021-04-26","2021-04-27","2021-04-25","2021-04-26","2021-04-25");

$date=array_unique($cars);
$no=1;
?>
<table class="table table-bordered">
<tr>
    <th>No</th>
    <th>Date</th>
</tr>
<?php
foreach($date as $d)
{
?>  
    <tr>
    <th colspan=2><?php echo $d; ?></th>
    </tr>
<?php
foreach($cars as $c)
{
    if($d == $c)
    {
?>
    <tr>
    <th><?php echo $no; ?></th>
    <th><?php echo $c; ?></th>
    </tr>
<?php
$no++;
}
}

}
?>

</body>
</html>
2021-11-24 06:44:58

W innych językach

Ta strona jest w innych językach

Русский
..................................................................................................................
Italiano
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................