I am trying to be able to access multiple dates and be able to map them to one player, and one country. The multiple years are in one table on the database, this table then uses foreign keys to attach the other two tables (player, country). How can access all of the years that the one individual won without adding it as a separate table?
below is my sql and php.
Many thanks in advance
$sql = "SELECT w.year, p.wikilink, c.countryname, c.countrylink, c.region, c.regionlink, p.playername, c.flag
FROM worldchampionperiod AS w
LEFT JOIN country AS c
ON w.Country_idcountry = c.idcountry
LEFT JOIN player AS p
ON w.player_idplayer = p.idplayer
GROUP BY p.idplayer
ORDER BY year";
$result = $conn->query($sql);
if ($result->rowCount() > 0) {
// output data of each row
while($row = $result->fetch()) {
echo "<tr>";
// echo "<td>" <a href=$row[""]>delete</a>. $row["playername"] . "</td>";
echo "<td>" . $row["playername"] . "</td>";
echo "<td>" . $row["year"] . "</td>";
//echo "<td>" . $row["countryname"] . <a href="'. $row["countrylink"] .'"> . "<br>" . $row["region"] . '<a href="'. $row["regionlink"] .'">' "</td>";
echo "<td>". '<a href="' . $row["countrylink"] .'">'. $row["countryname"].'</a>' ."<br>" . '<a href="' . $row["regionlink"] .'">'. $row["region"].'</a>' . "<br>" . '<img src="' .$row["flag"].'"width=30px>' . "</td>"; "</td>";
echo "</tr>";