<?php
$dynamicList = "";
$sql= mysql_query("SELECT products.product_name,products.price,products.subcategory,products.location,products.date_added, products.category,
products.id,categories.id,categories.category FROM products,categories ORDER BY date_added DESC LIMIT 6");
$productCount = mysql_num_rows($sql);
if ($productCount>0 )
{
$id= $row["id"];
$product_name= $row["product_name"];
$price = $row["price"];
$category = $row["category"];
$subcategory = $row["subcategory"];
$location = $row["location"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$dynamicList .= ' <div>' . $category. '</div>';
}
?>
How can I display the content on categories.category inside the $category variable? instead the $dynamicList variable is containing the products.category field content when it is displayed in the <div> tags.