1
將數據庫值放入HTML表格後,表格變大。任何CSS代碼都沒有幫助。我應該改變數據庫值類型的東西嗎?還是有其他建議?mysql_fetch_assoc後表格大小過大
下面是代碼:
<?php
$connector = mysql_connect('localhost','root','')
or die("Unable to connect");
echo "Connections are made successfully::";
$selected = mysql_select_db("user_registration", $connector)
or die("Unable to connect");
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM login ORDER BY 1 DESC ");
?>
<table class="table1" border="2" >
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Surename</th>
<th>Email</th>
<th>Gender</th>
<th>Username</th>
<th>Password</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysql_fetch_assoc($result)){
echo
"<tr >
<td >{$row['id']}</td>
<td>{$row['name']}</td>
<td>{$row['surename']}</td>
<td>{$row['email']}</td>
<td>{$row['gender']}</td>
<td>{$row['username']}</td>
<td>{$row['password']}</td>
</tr>\n";
}
?>
</tbody>
</table>
<?php mysql_close($connector); ?>
嗨,感謝您的評論,但我的問題是,錶行的列和高度過大(不想限制或任何東西)。該表是好的第一次,一旦我從數據庫中獲取數據表格變得非常大。謝謝! – Ardi