我需要每天从数据库中获取每天的结果

时间:2019-06-02 14:17:07

标签: php html

我正在尝试从程序中获取信息。我需要数据库检索每天的日期以及每天的所有事件和小时。

$data = $pdo->query("SELECT *
                     FROM programme_day
                     WHERE year = 2019
                     AND event = 1
                     ORDER BY day ASC")->fetchAll();
 foreach ($data as $row)
 {
 ?>

 <div><?php echo date('d-m-Y', $row['day']); ?></div>

 <?php
 }
 ?>

我需要结果显示如下:

TUESDAY JULY 23RD
10H00 - Lecture at FAUP - Arrhov Frick
11H00 - Lecture at FAUP - Johansen Skovsted
12H30 - Lunch break
14H00 - Workshop 

WEDNESDAY JULY 24TH
10H00 - Lecture at FAUP - Scheidegger Keller
11H00 - Lecture at FAUP - Nicolas Dorval-Bory
12H30 - Lunch break
14H00 - Workshop
19H00 - Lecture at FAUP 

THURSDAY JULY 25TH
10H00 - Lecture at FAUP - Dyvik Kahlen
11H00 - Lecture at FAUP - Fala
12H30 - Lunch break
14H00 - Workshop
22H00 - Submission of the Studios' Booklets
23H00 - End event
00H00 - Party

1 个答案:

答案 0 :(得分:0)

首先,当不回显事件时,您如何期望看到事件?也许您用那些WHERE event ='1'限制事件,但是我不确定,因为我必须查看整个数据库方案。如果您访问事件,则还可以在第一个事件中使用foreach来显示它们。