how can I make the duplicate record to be RECORDED AS ONE and the QUANTITY will get the total as 3 based on the picture below : [enter image description here[1]


  [1]: https://i.stack.imgur.com/Hj5Uu.png

//

                <?php
                $id=$_GET['invoice'];
                include('connect.php');
                $result = $db->prepare("SELECT * FROM sales_order WHERE invoice= 
                :userid");
                $result->bindParam(':userid', $id);
                $result->execute();
				
				
                for($i=0; $row = $result->fetch(); $i++){
                  ?>
//

this is the code