Advertisement
Guest User

Untitled

a guest
Jan 31st, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "bmkg";
  6. $stasiun = $_POST['stsn'];
  7. $source = $_POST['src'];
  8. $balai = $_POST['REGION'];
  9. $tanggal = $_POST['tanggal'];
  10. $file = $_POST['file'];
  11.  
  12. // Create connection
  13. $conn = mysqli_connect($servername, $username, $password, $dbname);
  14. // Check connection
  15. if (!$conn) {
  16. die("Connection failed: " . mysqli_connect_error());
  17. }
  18.  
  19. $sql = "INSERT INTO transaksi (id_stasiun, id_source, ID_REGION,tanggal,data)
  20. VALUES ('$stasiun', '$source', '$balai', '$tanggal','$file')";
  21.  
  22. if (mysqli_query($conn, $sql)) {
  23. echo '<script language="javascript">
  24. alert("Data Berhasil Di Input");
  25. window.location="index1.php";
  26. </script>';
  27. exit();
  28. } else {
  29. echo "Error: " . $sql . "<br>" . mysqli_error($conn);
  30. }
  31.  
  32. mysqli_close($conn);
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement