【发布时间】:2015-08-28 07:29:33
【问题描述】:
我有一个关于显示 PHP 表格的问题,应该是直截了当的,但我现在无法理解它,所以任何帮助都将不胜感激,基本上我想要做的就是在一个表,但显示多个用户表,并在其上方显示其团队名称。
我目前拥有的:http://puu.sh/ilUJp/4a6ae5e47b.png 我想要实现的目标:http://puu.sh/ilUJ8/7756033517.png
<div class="col-lg-6">
<h3>Team Name Goes Here </h3>
<?php
echo "<table class='table table-striped'>";
echo " <thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
";
while($row = mysqli_fetch_array($result)) {
$teamName = $row['teamName'];
$fName = $row['firstName'];
$surName = $row['surName'];
echo "
<tbody>
<tr>
<td>$teamName</td>
<td>$fName</td>
<td>$surName</td>
</tr>
</tbody>
";
}
echo "</table>";
?>
</div>
我的查询:
$sql = "SELECT t.teamID,t.teamName,u.firstName,u.surName From users as u INNER JOIN team as t where u.teamID = t.teamID ";
我知道我需要做的想法,但无法完成,因此我们将不胜感激。
【问题讨论】:
-
请添加您的表结构,它可以帮助我们回答您的问题。 ozh.github.io/ascii-tables
标签: php mysql html-table