<?php 
$cn= mysqli_connect("localhost", "motorfin_info", "infossel123.") or die('Could not connect');
$db= mysqli_select_db("motorfin_info", $cn) or die('Could not select database');

$ff = 8610;
    $query="SELECT * FROM pending"; 
       
    $result=mysqli_query($conn, $query);
    echo mysqli_error();


        while($row = mysqli_fetch_array($result, mysqli_BOTH))
       
        {
                $query1="SELECT * FROM pending WHERE hpl = '".$row[1]."'"; 
       
                $result1=mysqli_query($conn, $query1);
                $count = mysqli_num_rows($result1) - 1;
               
                mysqli_query($conn, "DELETE FROM pending WHERE hpl='".$row[1]."' LIMIT $count");
                echo "deleted $row[1] <br>";
           
}
        echo mysqli_error();
    ?>
       
