At the moment i have dynamic list which displays the latest products added to the inventory list. I want to display birthday cards from the category. In my database i have the column 'category', and in a form you can select different options with values one being birthday.
This is the code i have for the dynamic list, what change would i need to make so it displays the birthday cards?
div id="position" style="z-index: 1; width: 900px; height: 50px; position: absolute; top: 140px; left: 250px">
<?php
// Run a select query to get my letest 6 items
// Connect to the MySQL database
require ("scripts/connect.php");
$dynamicList = "";
$sql = mysql_query("SELECT * FROM products ORDER BY dateadded DESC LIMIT 6");
$productcount = mysql_num_rows($sql); // count the output amount
if ($productcount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$productname = $row["productname"];
$price = $row["price"];
$dateadded = strftime("%b %d, %Y", strtotime($row["dateadded"]));
$dynamicList .= '<table width="100%" 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="inventoryimages/' . $id . '.jpg" alt="' . $productname . '" width="77" height="102" border="1" /></a></td>
<td width="83%" valign="top">' . $productname . '<br />
£' . $price . '<br />
<a href="product.php?id=' . $id . '">View Product Details</a></td>
</tr>
</table>';
}
} else {
$dynamicList = "We have no products listed in our store yet";
}
mysql_close();
?>
<table >
<tr>
<td><?php echo $dynamicList; ?></td>
Thanks for any help!