I have the below MySQL statement in PHP taking the field pagecategory from pages. It is also distinct. The php loop in the body of the page lists the categories. I also have a field "title" in the database. I want the title of the products to be listed in a sub list underneath each category on the listing page. Does anyone know how I'd do this?
<?php
mysql_select_db($database_pspackaging, $pspackaging);
$query_get_categories = "SELECT DISTINCT pagecategory FROM pages ORDER BY pagecategory ASC";
$get_categories = mysql_query($query_get_categories, $pspackaging) or die(mysql_error());
$row_get_categories = mysql_fetch_assoc($get_categories);
?>
<?php do { ?>
<li><?php echo $row_get_categories['pagecategory']; ?></li>
<?php } while ($row_get_categories = mysql_fetch_assoc($get_categories)); ?>