我在一张桌子上有一个国家篮球队的名单,数据来自一个php数据库,每当我单击球队名称时,它会将我定向到球队名单并向我显示球员的姓名,但我每次单击该团队都无法显示每个团队的名称或徽标,我将附上一张图像,以更好地说明我在说什么。
我有一个文件夹,其中包含与每个团队相对应的所有图像。
这是我的团队代码
<?php
$connection = mysqli_connect('localhost', 'root', '','nba201819');
$result = mysqli_query($connection,"SELECT * FROM teams");
echo "<table border ='1'>
<tr>
<th></th>
<th>Code</th>
<th>Team</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td><img src='/logos/".$row['TEAMCODE']."'></td>" ;
echo "<td>" . $row['TEAMCODE'] . "</td>";
echo '<td><a href="roster.php?teamcode=' .$row['TEAMCODE'] .'">' . $row['NAME'] . "<a/></td>";
echo "</tr>";
}
echo "</table>";
?>
这是我的名册代码
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Roster</title>
</head>
<body>
<header>
<a href='teams.php'>Teams |</a>
<a href='players.php'>Players |</a>
<a href='teamStats.php'>Teams Stats |</a>
<a href='playerStatsJS.php'>Player Stats JS |</a>
<a href='playerFilterStatsJS.php'>Player Filter Stats JS |</a>
<a href='liveGamesJS.php'>Live Games JS |</a>
<a href='liveGamesUpdate.php'>Live Games Update |</a>
</header>
<hr>
<?php $teamcode = $_GET['teamcode']; ?>
<img src ="/logos/<?php echo $teamcode; ?>_logo.svg" width ="100" height="100">
<h1><?php echo $teamcode; ?> Roster </h1>
<hr>
</body>
<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
$connection = mysqli_connect('localhost', 'root', '','nba201819');
$teamcode = $_GET['teamcode'];
$result = mysqli_query($connection,"SELECT * FROM players WHERE TEAMCODE = '$teamcode' ");
echo "<table border ='1'>
<tr>
<th>Name</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['NAME'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>