Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. *
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. <?php
  8. //echo "cia";
  9. $server = "localhost";
  10. $user = "root";
  11. $pass = "";
  12. $db = "oro_uostas";
  13.  
  14. // Create connection
  15. $conn = new mysqli($server, $user, $pass, $db);
  16. // Check connection
  17. if ($conn->connect_error) {
  18. die("Connection failed: " . $conn->connect_error);
  19. }
  20.  
  21. $sql = "INSERT INTO darbuotojai (vardas, pavarde, gyvenamoji_vieta)
  22. VALUES ('".$_POST['vardas']."', '".$_POST['pavarde']."', '".$_POST['gyvenamoji_vieta']."')";
  23.  
  24. if ($conn->query($sql) === TRUE) {
  25. echo "Sėkmingai pridėta";
  26. } else {
  27. echo "Error: " . $sql . "<br>" . $conn->error;
  28. }
  29.  
  30. $conn->close();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement