Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Insert</title>
- </head>
- <body>
- <?php
- $host = "localhost";
- $username = "root";
- $password = "";
- $nama_db = "1084_db";
- $koneksi_db = mysqli_connect($host,$username,$password,$nama_db) or die (mysqli_error());
- if($koneksi_db)
- {
- $student_number = (isset($_POST['student_number']))? $_POST['student_number']: '';
- $student_name = (isset($_POST['student_name']))? $_POST['student_name']: '';
- $province = (isset($_POST['province']))? $_POST['province']: '';
- //$district_id = (isset($_POST['district_id']))? $_POST['district_id']: '';
- $perintah_sql = "INSERT INTO student VALUES('$student_number','$student_name','$province')";
- echo "$perintah_sql";
- echo "<br>";
- mysqli_query($koneksi_db,$perintah_sql) or die ("Proses Insert data GAGAL! <br> mysqli_error()");
- echo "Proses Insert data Berhasil";
- echo "<br>";
- echo "[<a href=view.php>Lihat Data Mahasiswa</a>]";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement