Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5. <center>
  6. <h1>FORMULARZ BAZODANOWY</h1>
  7. <p>
  8. <?php
  9. $servername = "localhost";
  10. $username = "root";
  11. $password = "";
  12. $dbname = "dane";
  13. $conn = new mysqli($servername, $username, $password, $dbname);
  14. if ($conn->connect_error) {
  15. die("Connection failed: " . $conn->connect_error);
  16. }
  17. $sql = "CREATE DATABASE dane";
  18. if (mysqli_query($conn, $sql)) {
  19. echo "Database created successfully";
  20. } else {
  21. echo "Error creating database: " . mysqli_error($conn);
  22. }
  23. echo "<p>";
  24. $sql = "CREATE TABLE osobowe (
  25. id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  26. imie VARCHAR(30) NOT NULL,
  27. nazwisko VARCHAR(30) NOT NULL,
  28. wiek INT(3),
  29. pesel INT(11),
  30. reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
  31. )";
  32.  
  33. if ($conn->query($sql) === TRUE) {
  34. echo "Table Osobowe created successfully";
  35. } else {
  36. echo "Error creating table: " . $conn->error;
  37. }
  38.  
  39. $conn->close();
  40. ?>
  41. <form action="" method="post" enctype="text/plain">
  42. Podaj swoje imię: <input name="imie"><br>
  43. Podaj swoje nazwisko: <input name="nazw"><br>
  44. Podaj swoj wiek: <input name="wiek"><br>
  45. Podaj swoje PESEL: <input name="pesel"><br>
  46. <input type="submit" value="Wyślij formularz">
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement