데이터 표 그룹화/로 구분하여 날짜

0

질문

나 MySQL 테이블

id 날짜 이름
1 2021-10-11 12:00:00 OG Loc 하나님 랩
2 2021-10-11 12:00:00 Ryder 하나님 Weedo
3 2021-10-10 12:00:00 Carl 하나님 아
4 2021-10-10 12:00:00 Johnson 하나님이 속이
5 2021-10-10 12:00:00 큰 전체가 금연 하나님 Crackzz
6 2021-10-9 12:00:00 달콤한 하나님의 형제

내가 원하는 것을 보관하는 것은 데이터와 함께 인쇄 PHP 에서 테이블과 분리하/그룹화하여 날짜:

# 권(신분증) 날짜 이름
2021-10-11
1 1 2021-10-11 12:00:00 OG Loc 하나님 랩
2 2 2021-10-11 12:00:00 Ryder 하나님 Weedo
2021-10-10
3 3 2021-10-10 12:00:00 Carl 하나님 아
4 4 2021-10-10 12:00:00 Johnson 하나님이 속이
5 5 2021-10-10 12:00:00 큰 전체가 금연 하나님 Crackzz
2021-10-09
6 6 2021-10-9 12:00:00 달콤한 하나님의 형제
html php
2021-11-24 05:46:14
1

최고의 응답

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

다른 언어로

이 페이지는 다른 언어로되어 있습니다

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