0
如何顯示水平網格中的數據庫數據。我有垂直顯示的代碼。但我需要它以horzontally顯示。如何在PHP中以水平網格顯示數據庫數據
<?php
$connect=mysql_connect("localhost","root","user");
mysql_selectdb("form");
$result=mysql_query("SELECT * FROM cath");
//echo "The details are....";
$dyn_table = '<table border="2" cellpadding="10">';
while($cath=mysql_fetch_array($result))
{
$ID=$cath["ID"];
$name=$cath["name"];
$email=$cath["email"];
$number=$cath["number"];
$org=$cath["org"];
$message=$cath["message"];
if ($cath==$cath)
{
$dyn_table .= '<tr><td>' . $name . '</td>';
$dyn_table .= '<tr><td>' . $email . '</td>';
$dyn_table .= '<tr><td>' . $number . '</td>';
$dyn_table .= '<tr><td>' . $org . '</td>';
$dyn_table .= '<tr><td>' . $message . '</td>';
}
}
$dyn_table .= '</tr></table>';
?>
<html>
<body>
<h3>PHP GRID LAYOUT</h3>
<?php
echo $dyn_table;
?>
</body>
</html>
你能幫我解決這個問題嗎?等待最佳解決方案。
感謝
Cathi