I am inserting mySQL result into table which has unique index on account number and trasaction date
foreach ($fulldata as $partdata){
$name=$partdata['name'];
$acno=$partdata['acno'];
$trdate=$partdata['trdate'];
$sql="INSERT into mytable (name,acno,trdate) values ('$name','$acno','$trdate')";
$result=mysqli_query($con,$sql) or die(mysqli_error($con));
}
If the entry is duplicate, the error is shown 'duplicate entry on...' and the loop is terminated. It does not take up next record for processing even if it does not have duplicate values with existing records in the database.
Ideally, it should show error for only those rows which has duplicate entry but insert all those records which are unique new entries. Can any other type of loop help ?