2017-04-17 27 views
0

我的數據庫中的數據表被推下並粘在我的頁腳上。我真的不知道如何解決問題,也不會堅持我的腳註。數據表被推下

if ($result->num_rows > 0) { 
    echo "<table style='border: solid 1px grey; margin-left: auto; margin-right: auto; margin-top: -20px;'><th>Film titel</th><th>Film genre</th>"; 
    // output data of each row 
    while($row = $result->fetch_assoc()) { 
     echo "<tr><td>" . $row["film_titel"]. "<td> " . $row["genre"]. "</td></td></tr><br>"; 
    } 
     echo "</table>"; 
} else { 
    echo "0 results"; 
} 

頁腳CSS:

footer { 
    position: absolute; 
    left: 0; 
    bottom: 0; 
    height: 100px; 
    width: 100%; 
    font-family: 'Roboto', sans-serif; 
    /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#619b28+0,427768+100 */ 
    background: #619b28; /* Old browsers */ 
background: -webkit-linear-gradient(left, #619b28 0%, #427768 100%); 
background: -o-linear-gradient(left, #619b28 0%, #427768 100%); 
background: linear-gradient(to right, #619b28 0%, #427768 100%); /* FF3.6-15 */ 
/* Chrome10-25,Safari5.1-6 */ 
/* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#619b28', endColorstr='#427768',GradientType=1); /* IE6-9 */ 
} 
+0

刪除底部:0從CSS。 – santhosh

+0

當我輸出數據時,表格變得如此之低?有什麼要做的嗎? – Russell

+0

可能與您的問題無關,但''元素也應包含在''中。 –

回答

0

有你的HTML語法錯誤。

  • <th>元素也應包含在<tr>
  • <td>元素是對方內線,打開另一個
  • 沒有理由把<br></tr>後要先關閉左側的一個。

您可以嘗試使用validator.w3.org來幫助您查找HTML錯誤。