我相對較新的PHP,並有一種感覺,我很長一段時間顯示數據從MySQL。需要幫助簡化我的php表
我有一張桌子我想從我的數據庫中顯示幾個字段。
我該如何實現這一點,而不必回顯表中的每一位?
下面是代碼:
<?php
$query1 = mysql_send("SELECT firstname, lastname, email, user, country FROM customers WHERE id='".$_COOKIE['custid']."'");
while ($row = mysql_fetch_array($query1))
{
echo ' <table id="account_table" style="width:550px; border:none; ">
<tr>
<td width="155">Contact Name</td>';
echo '<td width="335">';
echo $row['firstname'] ;
echo ' ';
echo $row['lastname'];
echo '</td>
</tr>
<tr>
<td>Email Address</td>
<td>';
echo $row['email'];
echo ' </td>
</tr>
<tr>
<td>Username</td>
<td>' ;
echo $row['user'];
echo '</td>
</tr>
<tr>
<td>Country</td>
<td>';
echo $row['country'];
echo '</td>
</tr>
<tr>
<td>Time Zone</td>
<td>GMT+1</td>
</tr>
<tr>
<td>Activated</td>
<td>16 Dec 2009</td>
</tr>
</table>';
}
?>
+1替代語法推薦 – 2010-05-17 21:22:24