Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_SERVER["REQUEST_METHOD"] == "POST") {
- if ($error != true ) {
- //connect to mysql database
- $servername = "localhost";
- $username = "adunton";
- $password = "german4";
- $dbname = "adunton";
- $conn = new mysqli($servername, $username, $password, $dbname);
- // this checks if i have connected successfully
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $checksql = "SELECT GameID
- FROM Reservations
- WHERE (start_Date BETWEEN )";
- // this part then inserts the values into the database
- $sql = "INSERT INTO reservations (Name, GameID, StartDate, NoOfDays)
- VALUES ('".$name."', '".$gameID."', '".$startDate."', '".$NoOfDays."')";
- // this then saves the reservation or checks for an error in the database
- if ($conn->multi_query($sql)) {
- echo "<br> Reservation Saved.";
- } else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
- $conn->close();
- }
- }
- ?>
Add Comment
Please, Sign In to add comment