You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
475 B
17 lines
475 B
<?php |
|
|
|
include "constants.php"; |
|
|
|
$db_connection = new mysqli("localhost", DB_USERNAME, DB_PASSWORD, "webdevcourse"); |
|
|
|
$nameres = $_POST['nameres']; |
|
$day = new DateTime($_POST['startres']); |
|
$endres = new DateTime($_POST['endres']); |
|
|
|
while ($day < $endres){ |
|
$dateToInsert = $day->format('Y-m-d'); |
|
$db_connection->query( |
|
"INSERT INTO `reservations` (`name`, `startdate`) VALUES ('$nameres', '$dateToInsert');" |
|
); |
|
$day->add(new DateInterval('P1D')); |
|
} |