Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <?php include '../html/Head.html'?>
  5. </head>
  6. <body>
  7. <?php include '../php/Menus.php' ?>
  8. <section class="main" id="s1">
  9. <div>
  10.  
  11. <?php
  12. $servername = "localhost";
  13. $database = "quiz";
  14. $username = "root";
  15. $password = "root";
  16. // Create connection
  17. $conn = mysqli_connect($servername, $username, $password, $database);
  18. // Check connection
  19. if (!$conn) {
  20. die("Connection failed: " . mysqli_connect_error());
  21. }
  22.  
  23. echo "Connected successfully";
  24.  
  25. $sql = "INSERT INTO Preguntas (correo, enunciado, correcta, incorrecta1, incorrecta2, incorrecta3, complejidad, tema) VALUES ($_POST["correo"], $_POST["enunciado"], $_POST["correcta"], $_POST["incorrecta1"], $_POST["incorrecta2"], $_POST["incorrecta3"], $_POST["enunciado"], $_POST["tema"])";
  26. if (mysqli_query($conn, $sql)) {
  27. echo "New record created successfully";
  28. } else {
  29. echo "Error: " . $sql . "<br>" . mysqli_error($conn);
  30. }
  31. mysqli_close($conn);
  32. ?>
  33.  
  34. </div>
  35. </section>
  36. <?php include '../html/Footer.html' ?>
  37. </body>
  38. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement