我无法在mysqli_
中创建或插入数据。当我var_dump($conn)
什么都没发生时。没有结果。这是我的代码。我该如何解决这个问题?
<?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);
}
我使用的是ubuntu 16.04。感谢