php remove duplicate values and show one

<?php
include ("../pos/db_config/db_config.php");
include ("../pos/functions/select.php");


$i = 0;
$sql = topsalep($idCompany);
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
    $end_sale_date = $row["end_sale_date"];
    $name = $row["name"];
    $tot_s = $row["tot_price"];
    $qc = $row["sales_item_qty"];



    $proResult[$i][0] = $name;
    $proResult[$i][1] = $end_sale_date;
    $proResult[$i][2] = $tot_s;
    $proResult[$i][3]  = $qc;
     $i++;
}


//$name = $proResult[0][0];
//echo "$name";

for ($i = 0; $i < $result->num_rows; $i++) {

    $count = 0;
    $name = $proResult[$i][0];
    $date = $proResult[$i][1];
    $price = $proResult[$i][2];
    $qct = $proResult[$i][3];
    $totalPrice = 0;



    for ($j = 0; $j < $result->num_rows; $j++) {
        if ($proResult[$j][1] == $date && $proResult[$j][0] == $name) {


            $x = $proResult[$j][2];

            $count++;
            $totalPrice+=$x;
        }



    }

    $name = $proResult[$i][0];
    $date = $proResult[$i][1];
    $price = $proResult[$i][2];

    for ($k = 0; $k < $count; $k++){
     if($proResult[$k][1] == $date && $proResult[$k][0] == $name)
     {

     }
    }

    echo "Name : $name  <br>";
    echo "End Date : $date : Count $count : total = $totalPrice <br><br>";    
    ?>

In this code I showed Last 5 days product vise total value. A one day can happen same sale id there different quantity of products. Then finally I calculated the one product wise total sale value. But problem is duplicate it. In my join query I used distinct But I want show my PHP code when duplicated values only show one value.

enter image description here

enter image description here