只需表格发布记录更多数据库

I made a simple form. In this form, if there is a code in the database to be registered, if I do not want to be recorded but I want to record both and 30-40 times to add to the database. Where am I making a mistake?

<?php 
                    if(isset($_POST['guncelle'])){

                        $kadi   =   $_POST["kadi"];
                        $gpa    =   $_POST["gpa"];
                        $miktar =   $_POST["price"];



                        $Kontrol = $db->query("SELECT * FROM veriler",PDO::FETCH_ASSOC);
                        if($Kontrol->rowCount()){
                                foreach ($Kontrol as $sorgu){
                                if($gpa==$sorgu['gpa']){
                            echo  ("<script>
                            Swal.fire({
                                type: 'error',
                                title: 'Hata!',
                                text: 'Girmiş olduğunuz kod daha önce kullanılmış!',
                              })
                            </script>");

                                }else{
                            $Kayit  =   $db->query("INSERT INTO veriler SET kullanici='$kadi', gpa='$gpa', durumu=0, miktari='$miktar'");
                            echo  ("<script>
                            Swal.fire(
                                'Good job!',
                                'You clicked the button!',
                                'success'
                              )
                            </script>");
                        }
                    }
                }
            }


  ?>