我有一個小問題,顯示HTML由於某種原因,它顯示從數據庫的第一個輸入輸入到實際頁面上的第二個條目,因此例如有數據庫中有2個用戶ID1和ID 2,有姓名以及用戶1的ID會顯示到用戶在頁面上2節,並與用戶1這裏同樣是一個圖像跌破發行 click here to view the imageSQL到HTML對齊
的完整代碼
<?php
$servername = "localhost";
$username = "root";
$password = "toor";
$dbname = "a3wasteland";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT UID, BattlEyeGUID, Name, BankMoney FROM PlayerInfo";
$result = $conn->query($sql);
?>
<div class='cWidgetContainer ipsHide' data-controller='core.front.widgets.area' data-role='widgetReceiver' data-orientation='horizontal' data-widgetArea='header'>
<ul class='ipsList_reset'>
</ul>
</div>
<div id="elCmsPageWrap" data-pageid="2">
<div>
<div class='ipsGrid ipsGrid_collapsePhone'>
<div class='ipsGrid_span6'>
<div class='cWidgetContainer ipsHide' data-controller='core.front.widgets.area' data-role='widgetReceiver' data-orientation='horizontal' data-widgetArea='col1'>
<ul class='ipsList_reset'>
</ul>
</div>
</div>
<div class='ipsGrid_span6'>
<div class='cWidgetContainer ipsHide' data-controller='core.front.widgets.area' data-role='widgetReceiver' data-orientation='horizontal' data-widgetArea='col2'>
<ul class='ipsList_reset'>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class='cWidgetContainer ' data-controller='core.front.widgets.area' data-role='widgetReceiver' data-orientation='horizontal' data-widgetArea='footer'>
<ul class='ipsList_reset'>
<li class='ipsWidget ipsWidget_horizontal ipsBox' data-blockID='plugin_20_sodPhpWidget_paxe9xcu5' data-blockConfig="true" data-blockTitle="PHP Code" data-controller='core.front.widgets.block'>
<div class='ipsWidget_inner '>
<p class='ipsType_reset ipsType_medium ipsType_light'>
<style>
.specialType_center th {
text-align: center;
}
</style>
</style>
<h2 class="ipsType_sectionTitle ipsType_reset cForumTitle ipsResponsive_hideTablet ipsResponsive_hidePhone <center> ">Arma 3 Player Stats</h2></center>
<table class="ipsTable ipsTable_responsive ipsTable_zebra ipsBox ipsType_center specialType_center ipsResponsive_hideTablet ipsResponsive_hidePhone">
<thead>
<tr>
<th>BattlEyeGUID</th>
<th>Name</th>
<th>BankMoney</th>
<th>UID</th>
</tr>
</thead>
<tbody>
<tr>
<?php
/* Other code */
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<td><span class="ipsType_negative"><?=$row["UID"]?></span></td></tr>
<td><span class="ipsType_negative"><?=$row["BattlEyeGUID"]?></span></td>
<td><span class="ipsType_negative"><?=$row["Name"]?></span></td>
<td><span class="ipsType_negative"><?=$row["BankMoney"]?></span></td>
<?php }
} else { ?>
<td colspan="5">0 results</td>
<?php } ?>
</tr>
</tbody>
</table>
</div></li>
</ul>
</div>
不,不工作,或者感謝嘗試反正http://prntscr.com/c6j7go,打破它更 –
我想有沒有人可以幫助這個奇怪的錯誤? –
檢查數據庫中的列是否正確? –