0){
switch ($_GET["table"]) {
case '1':
$table = "hotel_booking";
break;
case '2':
$table = "restaurant_booking";
break;
case '3':
$table = "attraction_booking";
break;
case '4':
$table = "guide_booking";
break;
case '5':
$table = "transport_flight_booking";
break;
case '6':
$table = "transport_railway_booking";
break;
default:
echo "Unknown booking type";
exit();
}
$quantity_query = "SELECT quantity FROM `$table` WHERE booking_id='$booking_id'";
$res = mysqli_query($conn, $quantity_query);
$old_quantity = mysqli_fetch_assoc($res);
$old_quantity = $old_quantity['quantity'];
$price_query = "SELECT `subtotal_price` FROM cart_bookings WHERE booking_id=" . $booking_id;
$priceRes = mysqli_query($conn, $price_query);
$price = mysqli_fetch_assoc($priceRes);
$price = $price["subtotal_price"];
$modified_price = $price * ($quantity - $old_quantity);
$add = "UPDATE `$table` SET quantity = '$quantity' WHERE booking_id='$booking_id'";
$res = mysqli_query($conn, $add);
if (!$res) {
echo "";
}
$total = "UPDATE user_buyer SET cart_total_price = cart_total_price + '$modified_price' WHERE u_id='$uid'";
$res = mysqli_query($conn, $total);
if (!$res) {
echo "";
}
}
}
header('Location: ../cart.php');
?>