Guest User

andy

a guest
Mar 2nd, 2016
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <?php
  2. if ($_SERVER["REQUEST_METHOD"] == "POST") {
  3. if ($error != true ) {
  4. //connect to mysql database
  5. $servername = "localhost";
  6. $username = "adunton";
  7. $password = "german4";
  8. $dbname = "adunton";
  9. $conn = new mysqli($servername, $username, $password, $dbname);
  10. // this checks if i have connected successfully
  11. if ($conn->connect_error) {
  12. die("Connection failed: " . $conn->connect_error);
  13. }
  14. $checksql = "SELECT GameID
  15. FROM Reservations
  16. WHERE (start_Date BETWEEN )";
  17. // this part then inserts the values into the database
  18. $sql = "INSERT INTO reservations (Name, GameID, StartDate, NoOfDays)
  19. VALUES ('".$name."', '".$gameID."', '".$startDate."', '".$NoOfDays."')";
  20. // this then saves the reservation or checks for an error in the database
  21. if ($conn->multi_query($sql)) {
  22. echo "<br> Reservation Saved.";
  23. } else {
  24. echo "Error: " . $sql . "<br>" . $conn->error;
  25. }
  26. $conn->close();
  27. }
  28. }
  29. ?>
Add Comment
Please, Sign In to add comment