Inputan Gagal dan Tidak Tersimpan dalam Database

Saya sedang menginputkan data nama kedalam Database, pada waktu saya mau nginput data urutan ke-55 tiba tiba muncul error data tersebut gagal tersimpan / gagal terinput seperti gambar berikut :
Gagal-Input.jpgGagal Input.jpg
Berikut Codingan full Input Data :
<!DOCTYPE html>
<?php
    include('koneksi.php');
    
    $query ="SELECT COUNT(*) FROM data_training";
    $result = mysqli_query($koneksi, $query);
    if($result) {
        $banyak_data = mysqli_fetch_array($result);
    }
?>

<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>Sistem Penentuan Seleksi Pegawai Baru</title>

    
    <link href="css/bootstrap.min.css" rel="stylesheet">

  </head>
  <body>
    <nav class="navbar navbar-inverse">
      <div class="container-fluid">
        
        
        <ul class="nav navbar-nav" >
            <li ><a href="index.php">Home</a></li>
            <li class="active"><a href="inputLatihAdmin.php">Data Training</a></li>
            <li ><a href="input-data-uji.php">Data Testing</a></li>
            <li ><a href="hasil-knn.php">Hasil Klasifikasi KNN</a></li>

          </ul>
        
        <ul class="nav navbar-nav navbar-right">
        <li ><a href="logoff.php">Log Out</a></li>
        </ul>

      </div>
    </nav>
    
  
    <h1 align="center">Sistem Penentuan Seleksi Pegawai Baru</h1>
    <h1 align="center"></h1>
    
    
    <form class="form-horizontal" method="post" action="proses-pelatihan-datatesting.php">
      <div class="form-group ">
        <label class="col-sm-1 control-label">Nilai K</label>
        <div class="col-sm-1 ">
          <input class="form-control"  placeholder="Banyak K" name="k_vall" required>
        </div>
         <button type="reset" class="btn btn-warning" >Reset</button>
      </div>
     
      <div class="form-group">
        <div class=" col-sm-offset-1 col-sm-2">
        
          <button type="submit" class="btn btn-primary btn-block">Mulai Pelatihan</button>
        </div>
      </div>
      <hr />
    </form>
                  
        <button type="button" class="btn btn-success col-sm-offset-9 col-sm-2" data-toggle="modal" data-target="#myModal">
          Input Data Training
        </button>

        
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
          <div class="modal-dialog" role="document">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Input Data Pegawai</h4>
              </div>
              <form class="form-horizontal col-sm-offset-2" method="post" action="tambahDataTraining.php">
                <div class="modal-body">
                  <div class="form-group ">
                    <label class="col-sm-4 control-label">Nama</label>
                    <div class="col-sm-6 ">
                     <input class="form-control" id=" "name="nama" required>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-4 control-label">Nilai IPK</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="" name="ipk" required>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label class="col-sm-4 control-label">Nilai Akademik</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="" name="akademik" required>
                    </div>
                  </div>
                  
                  <div class="form-group">
                    <label class="col-sm-4 control-label">Nilai IPTEK</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="" name="iptek" required>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-4 control-label">Nilai Wawancara</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="" name="wawancara" required>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-4 control-label">Klasifikasi</label>
                    <div class="col-sm-6">
                      <input class="form-control" id="" name="klasifikasi" required>
                    </div>
                  </div>

                </div>
                  <div class="modal-footer">
                  <button type="submit" class="btn btn-primary">Simpan</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
                  </div>
                </form>
            </div>
          </div>
        </div>
    
    <br>
    <br><br />
    <div class="table-responsive col-md-10 col-md-offset-1" style="height:350px;overflow:auto;">
          <table class="table table-bordered">
             <thead>
                  <tr>
                    <th>ID</th>
                    <th>Nama</th>
                    <th>Nilai IPK</th>
                    <th>Nilai Akademik</th>
                    <th>Nilai IPTEK</th>
                    <th>Nilai Wawancara</th>
                    <th>Klasifikasi</th>
                    <th>Edit Data</th>
                  </tr>
              </thead>
            
            <?php
                   //$c=0;
                include("koneksi.php");
                $sql = "SELECT * FROM data_training";
                $query = mysqli_query($koneksi,$sql);            
                $result = array(); 
                while ($data = mysqli_fetch_array($query)){                                                          
            ?>
              <tbody>
                <tr>
                    <td><?php echo $data[0] ?></td>
                    <td><?php echo $data[1] ?></td>
                    <td><?php echo $data[2] ?></td>
                    <td><?php echo $data[3] ?></td>
                    <td><?php echo $data[4] ?></td>
                    <td><?php echo $data[5] ?></td>
                    <td><?php echo $data[6] ?></td>
                    <td align="center" width="140">
                        <a href="form-edit-datatraining.php?id=<?php echo $data[0] ?>" class="btn btn-success btn-sm">
                            <span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Edit
                        </a>
                        <a href="deleteDataTraining.php?id=<?php echo $data[0] ?>" class="btn btn-danger btn-sm">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Del
                        </a>
                    </td>
                </tr>
            </tbody>
            <?php }          
            ?>
          </table>
    </div>
    

    
    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

Berikut codingan full Fungsi logika input datanya :
<?php
    include('koneksi.php');
    $nama = $_POST['nama'];
    $ipk = $_POST['ipk'];
    $akademik = $_POST['akademik'];
    $iptek = $_POST['iptek'];
    $wawancara = $_POST['wawancara'];
    
    $query = "INSERT into data_testing (nama,ipk,akademik,iptek,wawancara) 
    VALUES ('$nama','$ipk','$akademik','$iptek','$wawancara') 
    ";
    $result = mysqli_query($koneksi,$query);
    
    if($result){
        header("Location: input-data-uji.php");
    }else{
        echo "Input Gagal";
    }
?>

Mohon bantuannya dari para master sekalian
avatar Finn90

@Finn90

4 Kontribusi 0 Poin

  • coab diperiksa mulai dari isi $querynya apakah sudha sesuai yang diinginkan - @hilmanski


Jawaban

Belum ada Jawaban, jadi yang pertama

Login untuk gabung berdiskusi