Advertisement
Guest User

Untitled

a guest
Mar 20th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Insert</title>
  4. </head>
  5.  
  6. <body>
  7. <?php
  8. $host = "localhost";
  9. $username = "root";
  10. $password = "";
  11. $nama_db = "1084_db";
  12.  
  13. $koneksi_db = mysqli_connect($host,$username,$password,$nama_db) or die (mysqli_error());
  14.  
  15. if($koneksi_db)
  16. {
  17.  
  18.  
  19. $student_number = (isset($_POST['student_number']))? $_POST['student_number']: '';
  20. $student_name = (isset($_POST['student_name']))? $_POST['student_name']: '';
  21. $province = (isset($_POST['province']))? $_POST['province']: '';
  22. //$district_id = (isset($_POST['district_id']))? $_POST['district_id']: '';
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29. $perintah_sql = "INSERT INTO student VALUES('$student_number','$student_name','$province')";
  30. echo "$perintah_sql";
  31. echo "<br>";
  32. mysqli_query($koneksi_db,$perintah_sql) or die ("Proses Insert data GAGAL! <br> mysqli_error()");
  33.  
  34. echo "Proses Insert data Berhasil";
  35. echo "<br>";
  36. echo "[<a href=view.php>Lihat Data Mahasiswa</a>]";
  37. }
  38.  
  39.  
  40. ?>
  41. </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement