我正在尝试对以下代码进行 Ajax 调用,但我得到了一个 500 错误。任何关于我做错了什么的指示都将受到欢迎。谢谢
if isset(($_POST['lodgeChoice']))
{
require_once $_SERVER['DOCUMENT_ROOT'] . '/Includes/datalogin.php';
$lodgeChoice = $_POST['lodgeChoice'];
$startDate = $_POST['dateChosen'];
$duration = $_POST['duration'];
$endDate = strtotime($startDate. ' + ' . $duration . ' days');
$mysql_query = 'SELECT id FROM bookings WHERE (the_date BETWEEN "' . $startDate . '" AND "' . $endDate . '") AND id_item = ' . $lodgeChoice;
if($stmt = $mysqli->prepare('SELECT COUNT(*) FROM bookings WHERE (the_date BETWEEN "?" AND "?") AND (id_item = ?)');
$stmt->bind_param("sss",$startDate, $endDate,$lodgeChoice);
$stmt->execute();
$stmt->bind_result($count);
$stmt->fetch();
$stmt->close();
return ($count > 0 ? TRUE : FALSE);
}