admin mohon ada kesalahan coding di mysql_query

<?php
include 'koneksi.php';
		$CUSTOMER_NO = $_POST ['CUSTOMER_NO'];
		$CUSTOMER_NAME = $_POST ['CUSTOMER_NAME'];
		$BRANCH = $_POST ['BRANCH'];
		$ACCT_NUMBER = $_POST ['ACCT_NUMBER'];
		$SMS_1  = $_POST ['SMS_1'];
		$PHONE_1  = $_POST ['PHONE_1'];
		$ACCT_RECEIVED_NAME  = $_POST ['ACCT_RECEIVED_NAME'];
		$BRANCH_RECEIVED = $_POST ['BRANCH_RECEIVED'];
		$SIGN_NAME  = $_POST ['SIGN_NAME'];
		$LEGAL_ID = $_POST ['LEGAL_ID'];
		$START_DATE = $_POST ['START_DATE'];
		$END_DATE = $_POST ['END_DATE'];
		$STATUS = $_POST ['STATUS'];
		$DESCRIPTION = $_POST ['DESCRIPTION'];
		$INSTRUCTIONS_1 = $_POST ['INSTRUCTIONS_1'];
		$INSTRUCTIONS_2 = $_POST ['INSTRUCTIONS_2'];
		$INSTRUCTIONS_3 = $_POST ['INSTRUCTIONS_3'];
		$INSTRUCTIONS_4 = $_POST ['INSTRUCTIONS_4'];
		$INSTRUCTIONS_5 = $_POST ['INSTRUCTIONS_5'];
		$INSTRUCTIONS_6 = $_POST ['INSTRUCTIONS_6'];
		$INSTRUCTIONS_7 = $_POST ['INSTRUCTIONS_7'];
		$INSTRUCTIONS_8 = $_POST ['INSTRUCTIONS_8'];
		$DORMANT_ACTIVATION = $_POST ['DORMANT_ACTIVATION'];
		$UPLOAD = $_POST ['UPLOAD'];

if($CUSTOMER_NO=="")
{
  // echo "NIM kosong belum diisi, ";
  echo "<script>alert('CIF Belum diisi');history.go(-1);</script>";
}

if($CUSTOMER_NAME=="")
{
  echo "<script>alert('Nama Belum diisi');history.go(-1);</script>";
}

if($BRANCH=="")
{
  echo "<script>alert('Cabang Belum diisi');history.go(-1);</script>";
}
if($SMS_1=="")
{
  echo "<script>alert('No HP Belum diisi');history.go(-1);</script>";
}
if($START_DATE=="")
{
  echo "<script>alert('Tanggal Mulai Belum diisi');history.go(-1);</script>";
}
if($END_DATE=="")
{
  echo "<script>alert('Tanggal Berakhir Belum diisi');history.go(-1);</script>";
}
if($UPLOAD=="")
{
  echo "<script>alert('Upload LOI Belum diisi');history.go(-1);</script>";
}
  else
{

   $pilih="select * from perorangan where CUSTOMER_NO='$CUSTOMER_NO'";
   //$cek=mysqli_query($koneksi, $pilih);

   //$jumlah_data = mysqli_num_rows($cek);
   //if ($jumlah_data >= 1 )
   //{

  //echo "<script>alert('CIF sudah digunakan');history.go(-1);</script>";
    //}
   //else
{
   $query="INSERT INTO perorangan SET  CIF='$CUSTOMER_NO',NAMA NASABAH='$CUSTOMER_NAME',CABANG='$BRANCH',NO REK TUJUAN='$ACCT_NUMBER',NO HANDPHONE 1='$SMS_1',NO HANDPHONE 2='$PHONE_1',NAMA REKENING PENERIMA='$ACCT_RECEIVED_NAME',CABANG PENERIMA='$BRANCH_RECEIVED',NAMA PENERIMA KUASA='$SIGN_NAME',NO IDENTITAS KUASA='$LEGAL_ID',TANGGAL MULAI='$START_DATE',TANGGAL BERAKHIR,='$END_DATE',STATUS='$STATUS',KETERANGAN='$DESCRIPTION',INTRUKSI 1='$INSTRUCTIONS_1',INTRUKSI 2='$INSTRUCTIONS_2',INTRUKSI 3='$INSTRUCTIONS_3',INTRUKSI 4='$INSTRUCTIONS_4',INTRUKSI 5='$INSTRUCTIONS_5',INTRUKSI 6='$INSTRUCTIONS_6',INTRUKSI 7='$INSTRUCTIONS_7',INTRUKSI 8='$INSTRUCTIONS_8',AKTIVASI REK DORMANT='$DORMANT_ACTIVATION',UPLOAD LOI='$UPLOAD'";
	 mysqli_query($koneksi, $query);

echo "<script>alert('Data yang anda Input sukses');window.location='forminput.php'</script>";
    }
	}
?>
avatar dwinurpriyanto
@dwinurpriyanto

4 Kontribusi 0 Poin

Diperbarui 1 tahun yang lalu

Tanggapan

Pertanyaan kamu tidak jelas, coba dijelaskan lebih baik

4 Jawaban:

<div>Connected successfully<br><strong>Fatal error</strong>: Uncaught Error: mysqli object is already closed in C:\xampp\htdocs\Project\simpan.php:86 Stack trace: #0 C:\xampp\htdocs\Project\simpan.php(86): mysqli_query(Object(mysqli), 'INSERT INTO per...') #1 {main} thrown in <strong>C:\xampp\htdocs\Project\simpan.php</strong> on line <strong>86</strong></div>

avatar dwinurpriyanto
@dwinurpriyanto

4 Kontribusi 0 Poin

Dipost 1 tahun yang lalu

<div><a href="https://sekolahkoding.com/forum/masalah-stack-trace-1662957694">https://sekolahkoding.com/forum/masalah-stack-trace-1662957694</a><br><br>masalahnya sama kaya ini, coba bisa dipelajari.</div>

avatar nfa
@nfa

8 Kontribusi 3 Poin

Dipost 1 tahun yang lalu

<div>file koneksinya kemungkinan ada diclose jadinya mysql query yang dieksekusi gak berhasil karena gak ada koneksi ke database</div>

avatar muhammadridho30
@muhammadridho30

9 Kontribusi 2 Poin

Dipost 1 tahun yang lalu

<div>semoga membantu<br><br></div><pre>&lt;?php include 'koneksi.php'; $CUSTOMER_NO = $_POST['CUSTOMER_NO']; $CUSTOMER_NAME = $_POST['CUSTOMER_NAME']; $BRANCH = $_POST['BRANCH']; $ACCT_NUMBER = $_POST['ACCT_NUMBER']; $SMS_1 = $_POST['SMS_1']; $PHONE_1 = $_POST['PHONE_1']; $ACCT_RECEIVED_NAME = $_POST['ACCT_RECEIVED_NAME']; $BRANCH_RECEIVED = $_POST['BRANCH_RECEIVED']; $SIGN_NAME = $_POST['SIGN_NAME']; $LEGAL_ID = $_POST['LEGAL_ID']; $START_DATE = $_POST['START_DATE']; $END_DATE = $_POST['END_DATE']; $STATUS = $_POST['STATUS']; $DESCRIPTION = $_POST['DESCRIPTION']; $INSTRUCTIONS_1 = $_POST['INSTRUCTIONS_1']; $INSTRUCTIONS_2 = $_POST['INSTRUCTIONS_2']; $INSTRUCTIONS_3 = $_POST['INSTRUCTIONS_3']; $INSTRUCTIONS_4 = $_POST['INSTRUCTIONS_4']; $INSTRUCTIONS_5 = $_POST['INSTRUCTIONS_5']; $INSTRUCTIONS_6 = $_POST['INSTRUCTIONS_6']; $INSTRUCTIONS_7 = $_POST['INSTRUCTIONS_7']; $INSTRUCTIONS_8 = $_POST['INSTRUCTIONS_8']; $DORMANT_ACTIVATION = $_POST['DORMANT_ACTIVATION']; $UPLOAD = $_POST['UPLOAD'];

if ($CUSTOMER_NO == "") { echo "&lt;script&gt;alert('CIF Belum diisi');history.go(-1);&lt;/script&gt;"; } elseif ($CUSTOMER_NAME == "") { echo "&lt;script&gt;alert('Nama Belum diisi');history.go(-1);&lt;/script&gt;"; } elseif ($BRANCH == "") { echo "&lt;script&gt;alert('Cabang Belum diisi');history.go(-1);&lt;/script&gt;"; } elseif ($SMS_1 == "") { echo "&lt;script&gt;alert('No HP Belum diisi');history.go(-1);&lt;/script&gt;"; } elseif ($START_DATE == "") { echo "&lt;script&gt;alert('Tanggal Mulai Belum diisi');history.go(-1);&lt;/script&gt;"; } elseif ($END_DATE == "") { echo "&lt;script&gt;alert('Tanggal Berakhir Belum diisi');history.go(-1);&lt;/script&gt;"; } elseif ($UPLOAD == "") { echo "&lt;script&gt;alert('Upload LOI Belum diisi');history.go(-1);&lt;/script&gt;"; } else { $pilih = "select * from perorangan where CIF='$CUSTOMER_NO'"; $cek = mysqli_query($koneksi, $pilih); $jumlah_data = mysqli_num_rows($cek); if ($jumlah_data &gt;= 1) { echo "&lt;script&gt;alert('CIF sudah digunakan');history.go(-1);&lt;/script&gt;"; } else { $query = "INSERT INTO perorangan SET CIF='$CUSTOMER_NO', NAMA_NASABAH='$CUSTOMER_NAME', CABANG='$BRANCH', NO_REK_TUJUAN='$ACCT_NUMBER', NO_HANDPHONE_1='$SMS_1', NO_HANDPHONE_2='$PHONE_1', NAMA_REKENING_PENERIMA='$ACCT_RECEIVED_NAME', CABANG_PENERIMA='$BRANCH_RECEIVED', NAMA_PENERIMA_KUASA='$SIGN_NAME', NO_IDENTITAS_KUASA='$LEGAL_ID', TANGGAL_MULAI='$START_DATE', TANGGAL_BERAKHIR='$END_DATE', STATUS='$STATUS', KETERANGAN='$DESCRIPTION', INTRUKSI_1='$INSTRUCTIONS_1', INTRUKSI_2='$ <br></pre>

avatar adamajalah27
@adamajalah27

119 Kontribusi 40 Poin

Dipost 1 tahun yang lalu

Login untuk ikut Jawaban