$query = "SELECT * FROM bookings WHERE (the_date='" . $_POST['the_date'] . "' and id_item='". $_POST['id_item'] . "') AND (horario='". $_POST['horario'] . "' or horario='C')";