maandoverzicht
Het moet de maand en jaar als titel tonen met daaronder telkens de dag. Nu geeft hij ook voor maand X de dagen voor maand X en Y weer. Voor maand Y geeft hij ook de dagen voor maand X en Y weer.
Hoe kan ik ervoor zorgen dat alleen de maand wordt weergegeven van de titel?
September 2016
Maandag september 2016
Cat Begin einde Terrein kleedkamer
U17A 19:30:00 21:00:00 C1 4
U21 19:30:00 21:00:00 D2 4
Dinsdag september 2016
Cat Begin einde Terrein kleedkamer
U17B 18:00:00 19:30:00 D 6
U15B 18:00:00 19:30:00 D 5
Woensdag september 2016
Cat Begin einde Terrein kleedkamer
U13A 18:00:00 19:15:00 C2 5
U13B 18:00:00 19:15:00 C2 5
Donderdag september 2016
Cat Begin einde Terrein kleedkamer
P1 17:15:00 18:00:00 C 2
P4 19:30:00 21:00:00 B1 4
Vrijdag september 2016
Cat Begin einde Terrein kleedkamer
U9B 18:00:00 19:15:00 D 9
U10B 17:45:00 19:00:00 B2 8
Maandag oktober 2016
Cat Begin einde Terrein kleedkamer
U17A 19:30:00 21:00:00 C1 4
U21 19:30:00 21:00:00 D2 4
Dinsdag oktober 2016
Cat Begin einde Terrein kleedkamer
P1 17:15:00 18:00:00 C 2
P4 19:30:00 21:00:00 B1 4
Woensdag oktober 2016
Cat Begin einde Terrein kleedkamer
U11A 17:45:00 19:00:00 B2 2
U12A 19:00:00 20:30:00 B2 4
Donderdag oktober 2016
Cat Begin einde Terrein kleedkamer
P1 17:15:00 18:00:00 C 2
P4 19:30:00 21:00:00 B1 4
Vrijdag oktober 2016
Cat Begin einde Terrein kleedkamer
U9B 18:00:00 19:15:00 D 9
U10B 17:45:00 19:00:00 B2 8
October 2016
Maandag september 2016
Cat Begin einde Terrein kleedkamer
U17A 19:30:00 21:00:00 C1 4
U21 19:30:00 21:00:00 D2 4
Dinsdag september 2016
Cat Begin einde Terrein kleedkamer
U17B 18:00:00 19:30:00 D 6
U15B 18:00:00 19:30:00 D 5
Woensdag september 2016
Cat Begin einde Terrein kleedkamer
U13A 18:00:00 19:15:00 C2 5
U13B 18:00:00 19:15:00 C2 5
Donderdag september 2016
Cat Begin einde Terrein kleedkamer
P1 17:15:00 18:00:00 C 2
P4 19:30:00 21:00:00 B1 4
Vrijdag september 2016
Cat Begin einde Terrein kleedkamer
U9B 18:00:00 19:15:00 D 9
U10B 17:45:00 19:00:00 B2 8
Maandag oktober 2016
Cat Begin einde Terrein kleedkamer
U17A 19:30:00 21:00:00 C1 4
U21 19:30:00 21:00:00 D2 4
Dinsdag oktober 2016
Cat Begin einde Terrein kleedkamer
P1 17:15:00 18:00:00 C 2
P4 19:30:00 21:00:00 B1 4
Woensdag oktober 2016
Cat Begin einde Terrein kleedkamer
U11A 17:45:00 19:00:00 B2 2
U12A 19:00:00 20:30:00 B2 4
Donderdag oktober 2016
Cat Begin einde Terrein kleedkamer
P1 17:15:00 18:00:00 C 2
P4 19:30:00 21:00:00 B1 4
Vrijdag oktober 2016
Cat Begin einde Terrein kleedkamer
U9B 18:00:00 19:15:00 D 9
U10B 17:45:00 19:00:00 B2 8
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<php
$sql="SELECT id, DATE_FORMAT(`month_year`, '%M %Y') AS `month_year`, `dayname`,`team`,`training_start`,`training_end`,`terrain`,`dr`
FROM trainingskalender
ORDER BY Month(month_year), FIELD(`dayname`, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')";
//loop month & year
$result = $conn->query($sql);
// remembers the content from the previous loop
$month_year_buffer = '';
// loop through the data
while ($row = $result->fetch_assoc()) {
// get month and year
$month_year = $row['month_year'];
// test it against the buffered value
if ($month_year_buffer != $month_year)
{
// show it
echo "<b><font size=3 color=red>$month_year</font></b></br></br></br>";
$result1 = $conn->query($sql);
if ($result1->num_rows !== 0) {
while ($row1 = $result1->fetch_assoc()) {
if ($row1['dag'] != $huidigeDatum) {
echo "<table id='training_table'><tr ><th class='tab1' colspan='7'>". $row1['dag']." ". $row1['month_year']."</th></tr>";
echo "<tr '><th class='tab2'>team</th ><th class='tab2'>start</th><th class='tab2'>end</th><th class='tab2'>dressing room</th><th class='tab2'></th width='60'></tr>";
// output data of each row
$huidigeDatum = $row1['dag'] ;
}
echo "<tr><td class='center'>" . $row1["team`"]. "</td>";
echo "<td class='center'>" . $row1["training_start"]. "</td>";
echo "<td class='center'>" . $row1["training_end"]. "</td>";
echo "<td class='center'>" . $row1["terrein"]. "</td>";
echo "<td class='center'>" . $row1["dr"]. "</td>";
echo" ";
}
$huidigeDatum = ''; // niks
// and remember it
$month_year_buffer = $month_year;
} }
echo "</table>";
}
//Close connection
mysqli_close($conn);
$sql="SELECT id, DATE_FORMAT(`month_year`, '%M %Y') AS `month_year`, `dayname`,`team`,`training_start`,`training_end`,`terrain`,`dr`
FROM trainingskalender
ORDER BY Month(month_year), FIELD(`dayname`, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')";
//loop month & year
$result = $conn->query($sql);
// remembers the content from the previous loop
$month_year_buffer = '';
// loop through the data
while ($row = $result->fetch_assoc()) {
// get month and year
$month_year = $row['month_year'];
// test it against the buffered value
if ($month_year_buffer != $month_year)
{
// show it
echo "<b><font size=3 color=red>$month_year</font></b></br></br></br>";
$result1 = $conn->query($sql);
if ($result1->num_rows !== 0) {
while ($row1 = $result1->fetch_assoc()) {
if ($row1['dag'] != $huidigeDatum) {
echo "<table id='training_table'><tr ><th class='tab1' colspan='7'>". $row1['dag']." ". $row1['month_year']."</th></tr>";
echo "<tr '><th class='tab2'>team</th ><th class='tab2'>start</th><th class='tab2'>end</th><th class='tab2'>dressing room</th><th class='tab2'></th width='60'></tr>";
// output data of each row
$huidigeDatum = $row1['dag'] ;
}
echo "<tr><td class='center'>" . $row1["team`"]. "</td>";
echo "<td class='center'>" . $row1["training_start"]. "</td>";
echo "<td class='center'>" . $row1["training_end"]. "</td>";
echo "<td class='center'>" . $row1["terrein"]. "</td>";
echo "<td class='center'>" . $row1["dr"]. "</td>";
echo" ";
}
$huidigeDatum = ''; // niks
// and remember it
$month_year_buffer = $month_year;
} }
echo "</table>";
}
//Close connection
mysqli_close($conn);
Gewijzigd op 11/09/2016 22:35:57 door Kevin Franssen
September 2016
Maandag September 2016
Cat Begin einde locatie
...
Dinsdag September 2016
Cat Begin einde locatie
...
Woensdag September 2016
Cat Begin einde locatie
...
Donderdag September 2016
Cat Begin einde locatie
...
Vrijdag September 2016
Cat Begin einde locatie
...
Maandag October 2016
Cat Begin einde locatie
...
Dinsdag October 2016
Cat Begin einde locatie
...
Woensdag October 2016
Cat Begin einde locatie
...
Donderdag October 2016
Cat Begin einde locatie
...
Vrijdag October 2016
Cat Begin einde locatie
...
October 2016
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$result = $conn->query($sql);// month
$result1 = $conn->query($sql);// Dag
$huidigeMaand = ''; // leeg laten
// ...
while ($row = $result->fetch_assoc()) {
if ($row['month_year'] !== $huidigeMaand) {
// begin hier een nieuwe tabel met het maandoverzicht.
// en sla de nieuwe maand op om bijv. out te putten
echo "<table id='training_table'><tr ><th class='tab1' colspan='7'><font color='red'>". $row['month_year']."</font></th></tr>";
echo "<tr '><th class='tab2'>Cat</th ><th class='tab2'>Begin</th><th class='tab2'>einde</th><th class='tab2'>locatie</th><th class='tab2'></th width='60'></tr>";
if ($result1->num_rows > 0) {
while ($row1 = $result1->fetch_assoc()) {
if ($row1['dag'] != $huidigeDatum) {
echo "<table id='training_table'><tr ><th class='tab1' colspan='7'>". $row1['dag']." ". $row1['month_year']."</th></tr>";
echo "<tr '><th class='tab2'>Cat</th ><th class='tab2'>Begin</th><th class='tab2'>einde</th><th class='tab2'>locatie</th><th class='tab2'></th width='60'></tr>";
}
// output data of each row
$huidigeDatum = $row1['dag'] ;
}
echo "<tr><td class='center'>" . $row1["ploeg"]. "</td>";
echo "<td class='center'>" . $row1["training_start"]. "</td>";
echo "<td class='center'>" . $row1["training_end"]. "</td>";
echo "<td class='center'>" . $row1["terrein"]. "</td>";
echo "<td class='center'>" . $row1["kleedkamer"]. "</td>";
echo" ";
}
$huidigeMaand = $row['month_year'];
}}
echo "</table>";
?>
$result = $conn->query($sql);// month
$result1 = $conn->query($sql);// Dag
$huidigeMaand = ''; // leeg laten
// ...
while ($row = $result->fetch_assoc()) {
if ($row['month_year'] !== $huidigeMaand) {
// begin hier een nieuwe tabel met het maandoverzicht.
// en sla de nieuwe maand op om bijv. out te putten
echo "<table id='training_table'><tr ><th class='tab1' colspan='7'><font color='red'>". $row['month_year']."</font></th></tr>";
echo "<tr '><th class='tab2'>Cat</th ><th class='tab2'>Begin</th><th class='tab2'>einde</th><th class='tab2'>locatie</th><th class='tab2'></th width='60'></tr>";
if ($result1->num_rows > 0) {
while ($row1 = $result1->fetch_assoc()) {
if ($row1['dag'] != $huidigeDatum) {
echo "<table id='training_table'><tr ><th class='tab1' colspan='7'>". $row1['dag']." ". $row1['month_year']."</th></tr>";
echo "<tr '><th class='tab2'>Cat</th ><th class='tab2'>Begin</th><th class='tab2'>einde</th><th class='tab2'>locatie</th><th class='tab2'></th width='60'></tr>";
}
// output data of each row
$huidigeDatum = $row1['dag'] ;
}
echo "<tr><td class='center'>" . $row1["ploeg"]. "</td>";
echo "<td class='center'>" . $row1["training_start"]. "</td>";
echo "<td class='center'>" . $row1["training_end"]. "</td>";
echo "<td class='center'>" . $row1["terrein"]. "</td>";
echo "<td class='center'>" . $row1["kleedkamer"]. "</td>";
echo" ";
}
$huidigeMaand = $row['month_year'];
}}
echo "</table>";
?>
Gewijzigd op 25/09/2016 18:03:28 door Kevin Franssen
De tweede while zal alleen in de eerste while in de eerste loop werken, daarna is ie leeg.
Mijn kennis van PHP is nog niet zo goed.