数据库仅抓取第一行而不是当前

时间:2018-08-11 20:07:14

标签: php database datatables

因此我创建了此表,该表显示了来自phpmyadmin的数据表。当我单击编辑游戏以说出ID 9时,它仅显示第8行而不是第9行的数据。我相信这与这段代码有关,因为这是我看到错误发生的唯一位置。有人可以帮忙吗?如果您需要查看我的另一段代码,可以的,谢谢!

<?php 
$dbServername = "localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName = "games";
$conn = mysqli_connect($dbServername,$dbUsername,$dbPassword,$dbName);


$sql = "SELECT Id,Dates,GameType,SubType,GameName,FeeType,EntryFee,MinPlayers,MaxPlayers,MaxEn 
tries,PrizeDetails,GameType2 FROM games";
 $result = $conn->query($sql);

 if ($result->num_rows > 0) {

// output data of each row
while($row = $result->fetch_assoc()) {
    $Id = $row["Id"];
    $Dates = $row["Dates"];
    $GameType = $row["GameType"];
    $SubType = $row["SubType"];
    $GameName = $row["GameName"];
    $FeeType = $row["FeeType"];
    $EntryFee = $row["EntryFee"];
    $MinPlayers = $row["MinPlayers"];
    $MaxPlayers = $row["MaxPlayers"];
    $MaxEntries = $row["MaxEntries"];
    $PrizeDetails = $row["PrizeDetails"];
    $GameType2 = $row["GameType2"];
    echo "<br/>
      <h1><center>  Edit Game </h1> <br/><br/>

0 个答案:

没有答案