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">
		// 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">
		          <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>
		} else {
			$dynamicList = "We have no products listed in our store yet";
	<table >
	<td><?php echo $dynamicList; ?></td>

Thanks for any help!

6 Years
Discussion Span
Last Post by brants91

In your code you use one table ‘dateadded’ and you want to display a birthday card depending on someone birth date. Is that right till now? Sow there must be a relevance to your table , give your SHOW CREATE TABLE dateadded and describe the fields of the table (if you don’t already have comments on them (that you should)).


Sorry that code is what i followed to display the 6 latest additions to the inventory list.

Now i want to use that code to display only the cards that in the category column have been set as 'birthday' cards.

Sorry for confusion.

I would optimally like to have a system where the admin manager can view the birthday cards in a drop down menu. And from this assign them to selected areas in a table with the same information that is in the dynamicList. The attachment may help you understand what i am saying.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.