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();