Displaying Dynamic List Data Properly
Hi, I am making my first eCommerce site and am having trouble understanding how to pull my dynamic list data into a three column table so like | pic | pic | pic | I have tried everything I can think of, and I imagine the answer is simple as always. Thanks for any help, it is much appreciated! here is the code I am using atm:
PHP Code:
<?php
include "storescripts/connect_to_mysql.php";
$dynamicList = '';
$sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 16");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$price = $row["price"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$dynamicList .= '<table width="870" border="0" cellspacing="0" cellpadding="6">
<tr>
<td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="../inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="178" height="230" border="1" /></a><br /> ' . $product_name . '<br />
£' . $price . '<br />
<a href="product.php?id=' . $id . '">More Info</a></td>
</tr>
</table>';
}
} else {
$dynamicList = "We have no products listed in our store yet";
}
mysql_close();
?>