2017-01-02 29 views
1

我想顯示錶中的所有信息,但是當我查詢信息,然後把它放到一個PHP表中它不顯示任何數據在最後一個表中。 ScreenshotPHP不顯示錶中的最後一列

這裏是我的表

 <table border='1'> 
     <tr> 
      <th>Ticket ID</th> 
      <th>Username</th> 
      <th>Message</th> 
      <th>Date</th> 
      <th>Error #</th> 
      <th>Priority</th> 
     </tr> 

     <?php 
     if(!$query){ 
      die('Invalid query: ' .mysql_error()); 
     } 
     while ($row = mysql_fetch_array($query)) { ?> 
      <tr> 
       <td><?php echo $row['TicketID']; ?></td> 
       <td><?php echo $row['Message']; ?></td> 
       <td><?php echo $row['Date']; ?></td> 
       <td><?php echo $row['Error']; ?></td> 
       <td><?php echo $row['Priority']; ?></td> 
      </tr> 
     <?php } ?> 
    </table> 

這裏PHP代碼查詢

<?php 
$server = mysql_connect("localhost", "root", "**password**"); 
$db = mysql_select_db("minecraft", $server); 
$query = mysql_query("SELECT * FROM tickets"); 
?> 

我所有的行名是正確的PHP代碼,但它不希望把將數據輸入到該列中。

這裏是我的表結構 Table Structure

+0

你能證明你的MySQL表結構? – Sean

+0

@Sean [結構](http://i.imgur.com/tSfVDu6.png) –

+2

如何查詢 – Beginner

回答

5

您略

<td><?php echo $row['Username']; ?></td> 

,應該是後

<td><?php echo $row['TicketID']; ?></td> 
相關問題