Query levert maar 1 record.
regel 40 moet dus NA de controle komen of het om hetzelfde land gaat.
Het zal wel aan mij liggen maar ben het een beetje kwijt.
Is dit nu wat je bedoeldt??
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
// Vul hier een rapport specifiek clausule in.
// In dit rapport gaat het om welke combinaties hebben een onderkomen in de caravan nodig
$sqlCombiWHERE = " WHERE 2010Combination.accomGroom = 'YES' ";
// +-----Table header --------------------------------------------------------+
$tbl = '<table cellspacing="0" cellpadding="0" border="1" width="100%">
<tr>
<th width="30"> </th>
<th width="50">Caravan</th>
<th width="200">Name</th>
<th width="150">Telefoon</th>
<th width="145">Horse</th>
<th width="">Country</th>
</tr> ';
// </table>';
$previousCountry = " ";
$report = $_GET['report'];
$sqlCombiBASIC = "
SELECT person.*, horse.*, 2010Combination.*, country.* , country.*
FROM FEIPerson AS person
JOIN 2010Combination ON person.fei_id = 2010Combination.personFEIid
JOIN FEIHorse horse ON horse.fei_id = 2010Combination.horseFEIid
JOIN country ON country.ISO_A3 = person.competing_for_country ";
$sqlCombiORDER = "
ORDER BY person.competing_for_country, 2010Combination.compNumber ASC ";
$sqlCombination = $sqlCombiBASIC . $sqlCombiWHERE . $sqlCombiORDER;
if(!$Result = mysqli_query($dblink, $sqlCombination)) {
$html = "There is een error opening table for ". $report. "; ".mysqli_error($dblink)."<br />";
$html .= "<br />=========================<br />";
} else { // database is aanwezig en geopend
$numFemale = $numMale = 0;
$EV_Year = date('Y') . "<br />";
$numberCombinations = mysqli_affected_rows($dblink);
$html .= $EV_Year;
$html = "<br />=========================<br />";
/* fetch associative array */
while ($Row= mysqli_fetch_assoc($Result)) {
/*
$tbl .= ' <tr>
<td>'.$Row["compNumber"].'</td>
<td>'.$Row["caravanNumber"].'</td>
<td>'.$Row["nameGroom"].'</td>
<td>+'.$Row["cellGroom"].'</td>
<td>'.$Row["current_name"].'</td>
<td>'.$Row["competing_for_country"].'</td>
</tr>';
*/
// -----------------------------------------------------------+
// Verkrijg aantal vrouwelijke verzorgers (Groom)
if($Row["genderGroom"] == 'Female') $numFemale++;
//Doe dit ook voor mannelijke groom's
elseif($Row["genderGroom"] == 'Male') $numMale++;
// -----------------------------------------------------------+
if($previousCountry!=$Row["competing_for_country"]) {
$previousCountry=$Row["competing_for_country"];
// add a page
$pdf->AddPage('P', 'A4');
// -----------------------------------------------------------+
$pdf->writeHTML($tbl, true, false, true, false, ' ');
// -----------------------------------------------------------+
} else { $previousCountry=$Row["competing_for_country"];
$tbl .= ' <tr>
<td>'.$Row["compNumber"].'</td>
<td>'.$Row["caravanNumber"].'</td>
<td>'.$Row["nameGroom"].'</td>
<td>+'.$Row["cellGroom"].'</td>
<td>'.$Row["current_name"].'</td>
<td>'.$Row["competing_for_country"].'</td>
</tr>';
}
} // end while
} // end
// Maak een pagina voor totalen
$sql = "<br />=========================<br />";
$sql .= "Aantal Groom in caravan: ". $numberCombinations . "<br />";
$sql .= "Aantal Vrouwlijk: ". $numFemale . "<br />";
$sql .= "Aantal Manlijk: ". $numMale . "<br />";
$sql .= "<br />=========================<br />";
// add a page
$pdf->AddPage('P', 'A4');
// -----------------------------------------------------------+
$pdf->writeHTML($sql, true, false, true, false, ' ');
// -----------------------------------------------------------+
?>
// Vul hier een rapport specifiek clausule in.
// In dit rapport gaat het om welke combinaties hebben een onderkomen in de caravan nodig
$sqlCombiWHERE = " WHERE 2010Combination.accomGroom = 'YES' ";
// +-----Table header --------------------------------------------------------+
$tbl = '<table cellspacing="0" cellpadding="0" border="1" width="100%">
<tr>
<th width="30"> </th>
<th width="50">Caravan</th>
<th width="200">Name</th>
<th width="150">Telefoon</th>
<th width="145">Horse</th>
<th width="">Country</th>
</tr> ';
// </table>';
$previousCountry = " ";
$report = $_GET['report'];
$sqlCombiBASIC = "
SELECT person.*, horse.*, 2010Combination.*, country.* , country.*
FROM FEIPerson AS person
JOIN 2010Combination ON person.fei_id = 2010Combination.personFEIid
JOIN FEIHorse horse ON horse.fei_id = 2010Combination.horseFEIid
JOIN country ON country.ISO_A3 = person.competing_for_country ";
$sqlCombiORDER = "
ORDER BY person.competing_for_country, 2010Combination.compNumber ASC ";
$sqlCombination = $sqlCombiBASIC . $sqlCombiWHERE . $sqlCombiORDER;
if(!$Result = mysqli_query($dblink, $sqlCombination)) {
$html = "There is een error opening table for ". $report. "; ".mysqli_error($dblink)."<br />";
$html .= "<br />=========================<br />";
} else { // database is aanwezig en geopend
$numFemale = $numMale = 0;
$EV_Year = date('Y') . "<br />";
$numberCombinations = mysqli_affected_rows($dblink);
$html .= $EV_Year;
$html = "<br />=========================<br />";
/* fetch associative array */
while ($Row= mysqli_fetch_assoc($Result)) {
/*
$tbl .= ' <tr>
<td>'.$Row["compNumber"].'</td>
<td>'.$Row["caravanNumber"].'</td>
<td>'.$Row["nameGroom"].'</td>
<td>+'.$Row["cellGroom"].'</td>
<td>'.$Row["current_name"].'</td>
<td>'.$Row["competing_for_country"].'</td>
</tr>';
*/
// -----------------------------------------------------------+
// Verkrijg aantal vrouwelijke verzorgers (Groom)
if($Row["genderGroom"] == 'Female') $numFemale++;
//Doe dit ook voor mannelijke groom's
elseif($Row["genderGroom"] == 'Male') $numMale++;
// -----------------------------------------------------------+
if($previousCountry!=$Row["competing_for_country"]) {
$previousCountry=$Row["competing_for_country"];
// add a page
$pdf->AddPage('P', 'A4');
// -----------------------------------------------------------+
$pdf->writeHTML($tbl, true, false, true, false, ' ');
// -----------------------------------------------------------+
} else { $previousCountry=$Row["competing_for_country"];
$tbl .= ' <tr>
<td>'.$Row["compNumber"].'</td>
<td>'.$Row["caravanNumber"].'</td>
<td>'.$Row["nameGroom"].'</td>
<td>+'.$Row["cellGroom"].'</td>
<td>'.$Row["current_name"].'</td>
<td>'.$Row["competing_for_country"].'</td>
</tr>';
}
} // end while
} // end
// Maak een pagina voor totalen
$sql = "<br />=========================<br />";
$sql .= "Aantal Groom in caravan: ". $numberCombinations . "<br />";
$sql .= "Aantal Vrouwlijk: ". $numFemale . "<br />";
$sql .= "Aantal Manlijk: ". $numMale . "<br />";
$sql .= "<br />=========================<br />";
// add a page
$pdf->AddPage('P', 'A4');
// -----------------------------------------------------------+
$pdf->writeHTML($sql, true, false, true, false, ' ');
// -----------------------------------------------------------+
?>