mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given -
$query = "SELECT type, SUM(price) FROM products GROUP BY type";
$result=mysqli_query($db, $query);
while($row = mysqli_fetch_array($result)){
echo "Total ". $row['type']. " = $". $row['SUM(price)'];
}