I'm trying to build a demo website showcasing the food and/or products in your home ie. fridge or freezer.
I've got most of it down, dynamically creating a list with the items, but I would like to have the duplicates count up like 1x [product] instead of just appearing multiple times in the list like this:
.
My query and stuff looks like this - all inside a for loop.
$sql = "SELECT * FROM goods WHERE person_id = " . $_SESSION['ID'] . " AND room LIKE '" . $rooms[$count] . "'";
if ($result = mysqli_query($conn, $sql)){
if (mysqli_num_rows($result) > 0){
$output = "<ul>";
while ($row = mysqli_fetch_array($result)){
$output .= "<li class='varer'> " . $row['name'] . "</li>";
}
$output .= "</ul>";
}
}
Hope you can help - I'm not that experienced with PHP :)