0

I can't create or insert data into mysqli_. When I var_dump($conn) nothing happen. No result. Here's my code. How can I fix this?

<?php
// Koneksi
$conn = mysqli_connect("localhost","root","12345","mahasiswa");
// Cek apakah tombol submit
if(isset($_POST["submit"]) ) {


$nrp = $_POST["nrp"];
$nama = $_POST["nama"];
$email = $_POST["email"];
$jurusan = $_POST["jurusan"];

// Query insert data
$query = "INSERT INTO daftar_mahasiswa(nrp, nama, email, jurusan)
            VALUES('$nrp','$nama','$email','$jurusan')";

mysqli_query($conn, $query);

// Cek apakah data berhasil di tambahkan
return mysql_affected_rows($conn);

}

I'm using ubuntu 16.04. Thanks

Difster
  • 3,264
  • 2
  • 22
  • 32
  • 2
    What errors are you getting? [How do I get PHP errors to display?](https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display) Also see: `mysqli_connect_error() ` – ficuscr Jan 31 '18 at 22:26
  • 2
    too many missing parts here and you're mixing apis – Funk Forty Niner Jan 31 '18 at 22:29
  • 1
    *"How can i fix this"* - By debugging which you're not doing and it's all part of coding. You need to learn how to do this. – Funk Forty Niner Jan 31 '18 at 22:30

0 Answers0