3 rijen omzetten naar één rij
Mijn huidige pagina ziet er nu zo uit https://voetbalmatch.eu/tour.php, maar moet er uit gaan zien zoals deze pagina https://voetbalmatch.eu/index.php. Hoe is dit te realiseren in PHP
Hieronder mijn code tot nu toe.
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
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
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>World Cup</th>
<th>Host</th>
<th>Country</th>
<th>Position</th>
<th>MP</th>
<th>GS</th>
<th>AVG</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT tournament_standings.tournament_id,
tournament_standings.position,
tournament_standings.team_id,
tournaments.tournament_id,
tournaments.host_country,
teams.team_id,
teams.team_code,
teams.team_name
FROM tournament_standings
INNER JOIN teams
ON tournament_standings.team_id = teams.team_id
INNER JOIN tournaments
ON tournament_standings.tournament_id = tournaments.tournament_id
WHERE tournament_standings.position < '4'
ORDER BY tournament_standings.tournament_id ASC";
$query_run = mysqli_query($conn, $query) or die("database error:". mysqli_error($conn));
if(mysqli_num_rows($query_run) > 0)
{
foreach($query_run as $row)
{
?>
<tr>
<td><?= $row['tournament_id']; ?></td>
<td><?= $row['host_country']; ?></td>
<td><?= "<img src=../images/flags/country/" .$row['team_code'] .".png>" ." " .$row['team_name']; ?></td>
<?php if ($row['position'] == 1) { ?> <td>Champion</td> <?php }if ($row['position'] == 2){ ?> <td>Runner up</td> <?php }if ($row['position'] == 3){ ?> <td>Third place</td> <?php }?>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="4">No Record Found</td>
</tr>
<?php
}
?>
<thead>
<tr>
<th>World Cup</th>
<th>Host</th>
<th>Country</th>
<th>Position</th>
<th>MP</th>
<th>GS</th>
<th>AVG</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT tournament_standings.tournament_id,
tournament_standings.position,
tournament_standings.team_id,
tournaments.tournament_id,
tournaments.host_country,
teams.team_id,
teams.team_code,
teams.team_name
FROM tournament_standings
INNER JOIN teams
ON tournament_standings.team_id = teams.team_id
INNER JOIN tournaments
ON tournament_standings.tournament_id = tournaments.tournament_id
WHERE tournament_standings.position < '4'
ORDER BY tournament_standings.tournament_id ASC";
$query_run = mysqli_query($conn, $query) or die("database error:". mysqli_error($conn));
if(mysqli_num_rows($query_run) > 0)
{
foreach($query_run as $row)
{
?>
<tr>
<td><?= $row['tournament_id']; ?></td>
<td><?= $row['host_country']; ?></td>
<td><?= "<img src=../images/flags/country/" .$row['team_code'] .".png>" ." " .$row['team_name']; ?></td>
<?php if ($row['position'] == 1) { ?> <td>Champion</td> <?php }if ($row['position'] == 2){ ?> <td>Runner up</td> <?php }if ($row['position'] == 3){ ?> <td>Third place</td> <?php }?>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="4">No Record Found</td>
</tr>
<?php
}
?>
Er zijn nog geen reacties op dit bericht.