讓像上述簡單介紹一下它。
我想要做什麼(但顯然不能)是顯示在第一列中顯示的運動中的每個球隊(CAS,CEIT,CASNR,CSE)的相應得分。
這是我迄今爲止..
<table class="table table-bordered">
<thead>
<tr>
<th>Games</th>
<th class="danger">CAS</th>
<th class="warning">CEIT</th>
<th class="success">CASNR</th>
<th class="info">CSE</th>
</tr>
</thead>
<tbody>
<?php
include('connection.php');
$sportid = '';
$query=mysql_query("SELECT * FROM sports ORDER BY sportname")or die(mysql_error());
while($row=mysql_fetch_array($query)) {
$sportid = $row['sportid'];
?>
<tr>
<td><input type="hidden" id="sportid[]" name="sportid[]" value="<?php echo $row['sportid']; ?>"><?php echo $row['sportname']; ?> </td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<?php } ?>
</tr>
<tr>
<td class="success">Total Points</td>
<td class="info">0</td>
<td class="info">0</td>
<td class="info">0</td>
<td class="info">0</td>
</tr>
</tbody>
</table>
附:如果在特定運動中沒有來自表score
的數據,它仍然應該顯示零。
yey!有用。但是我在中得到'undefined offset:0',它沒有可用的數據。不過謝謝! :D – eirishainjel 2015-02-12 08:13:29
你可以檢查每次是否設置數組的值,如果不回顯0 – 2015-02-12 09:16:54
是的!現在好了:)謝謝。 – eirishainjel 2015-02-13 00:01:56