-4

Sorry, I have trouble this scrip, die(mysqli_error()); , i try change to die(mysqli_error($koneksi)); ,but not solved. Thanks in advance

$insert = mysqli_query($koneksi, "INSERT INTO karyawan (nik, nama, tempat_lahir, tanggal_lahir, statusp, suis, janak, alamat, domisili, no_ktp, no_telepon, no_bpjs, no_bpjsk, no_rek, no_npwp, jabatan, status, username, password)
VALUES ('$nik','$nama', '$tempat_lahir', '$tanggal_lahir', '$statusp', '$suis', '$janak', '$alamat', '$domisili', '$no_ktp', '$no_telepon', '$no_bpjs', '$no_bpjsk', '$no_rek', '$no_npwp', '$jabatan', '$status', '$username', '$pass')") 
or die(mysqli_error())
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

-1

First of all note that mysqli_error() need link identifier as a ist param like:

mysqli_error($koneksi)

Second, you forgot to terminate your line, you must need to use semi colon for terminate this line.

Third, if you are getting blank page, than you must need to use php error_reporting() in your code in development mode not for production.

Fourth, Don't know where you define your variables, if its user input than note that your code is open for SQL injection. You can use Prepared Statement will help you to prevent your query with SQL Attack: How can I prevent SQL injection in PHP?

Side Note: explore provided links and modify your code, i hope this will help you.

Community
  • 1
  • 1
devpro
  • 16,184
  • 3
  • 27
  • 38