1
這是我的dynamicList(你幫我創建了多個列) 但是我忘記了通過創建多個列/行inseide表,如果我有20個項目要顯示,我必須等到整個桌子準備好了,我不想那樣做。DynamicList with Multiple Columns
我該如何解決這個問題,以便在新表格中顯示每行?
if ($productCount > 0) {
$i=0;
$dynamicListBody = '<table width: 90%; margin-right: auto; margin-left: auto; color: #00E6AA;>';
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$details = $row["details"];
$price = $row["price"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$dynamicListBody .= ($i==0) ? '<tr>':'';
$dynamicListBody .= '<td width="10%">
<img style="border:#666 1px solid;" src="../stock_photos/' . $id . '.png" height="80px" width="40px" alt="' . $product_name . '" />
</td>
<td width="35%">
<span class=itmttl>' . $product_name . '</span>
<br />
<span class=text>' . $details . '
<br />
€' . $price . '</span>
<br />
<form name="bd_itm" id="bd_itm" method="post" action="help_scripts/cart_functions.php">
<input type="hidden" name="pid" id="pid" value="' . $id . '" />
<input type="submit" name="button" id="button' . $id . '" value="Add to Cart" />
<br />
<br />
</form>
</td>';
$dynamicListBody .= ($i==1) ? '</tr>':'';
$i++;
($i==2) ? $i=0:'';
}
$dynamicListBody .='</table>';
} else {
$dynamicListBody = "We have no products listed in our store yet";
}
mysql_close();