カテゴリを取得する際に混乱があり、各サブカテゴリを一度だけエコーしたい..
<?php
mysql_connect("localhost", "root", "")or die(mysql_error())//connect to mysql;
mysql_select_db("ubcommerce")//select database;
$catagories = "";
$sql = mysql_query("SELECT * FROM inventory ORDER BY subcatagory DESC")//select data from table;
$found = mysql_num_rows($sql);
if ($found > 0) {
while ($row = mysql_fetch_array($sql)) {
// Gather all $row values into local variables for easier usage in output
$subcatagory = $row['subcatagory'];
$link = $row['catagory'];
$link = lcfirst($link);
$catagories .= "<li>$subcatagory</li>";
}
} else {
$catagories = "you have no product in your list yet";
}
?>
<html>
<body>
<div class="col-content">
<ul>
<?php echo $catagories; ?>
</ul>
</div>
</body>
</html>