$db = mysqli_select_db($con, 'accommodation');
function update_booking()
{
    global $con, $db, $h_no, $a;
    $query = "UPDATE booking SET booking_flag = '0' where id='{$a}' and house_no='{$h_no}'";
    if (!$con->query($query)) {
        echo "UPDATE failed";
    } else {
        echo "Booking Cancelled";
    }
}
function update()
{
    global $con, $db, $h_no;
    $query = "UPDATE permanent_acco SET availability = '1' where house_no='{$h_no}'";
    if (!$con->query($query)) {
        echo "UPDATE failed";
    } else {
        //	echo "Cancelled";
    }
}
update_booking();
update();
echo '</br> </br><a href="pros_home.php" style=" background:#000099; border:none; color:white; font-family:georgia; font-size:20px; height: 25px; width: 100px; border-radius:5px; left: 20px; top: 10px;">Return</a>';
?>
			</div>
		</div>
	</div> <!-- /#contents -->
	
</body>
</html>
         if ($booking->get_date_in() != "Will Call") {
             $date_in = $booking->get_date_in();
         }
     }
     echo "<br>Viewing booking for ";
     echo $guest->get_first_name() . " " . $guest->get_last_name();
     echo " submitted on " . date_string($booking->get_date_submitted()) . " ";
     if ($booking->get_status() != "closed" && $_SESSION['access_level'] != 2) {
         echo '<a href = "referralForm.php?id=update&referralid=' . $booking->get_id() . '" > (Edit this booking) </a><br>';
     } else {
         echo "<br>";
     }
     //echo "(To find other bookings or referrals, <a href='searchBookings.php'>search the database</a>!)";
     //updates the booking if changes have just been submitted
     if ($_POST['submit'] == "Submit") {
         $update_result = update_booking($id);
         if ($update_result != 'incomplete' && $update_result != false) {
             echo "<b> <center> <font color = green> You have successfully updated this booking </font> </center> </b>";
             $booking = $update_result;
         }
         if ($update_result == false) {
             echo "ERROR: Booking could not be updated.";
         }
     }
     //show the details of the booking
     include 'bookingDetails.inc';
 } else {
     echo "<p><strong>Viewing all Pending Bookings (Referrals)</strong><br />";
     echo "(To find other bookings or referrals, <a href='searchBookings.php'>search the database</a>!)";
     //grab the sort parameter
     $s = $_GET['sort'];