<?php
error_reporting(0);
session_start();
include '../include/connection.php';
$conn     = db();
$id=$_GET['id'];
$position=$_GET['position'];
$qryold=mysqli_query($conn,"select * from tbl_gallery where gallery_id='$id'");
$resold=mysqli_fetch_array($qryold);
$qry=mysqli_query($conn,"select * from tbl_gallery where gallery_position='$position'");
$res=mysqli_fetch_array($qry);
$bid=$res['gallery_id'];
$bposition=$resold['gallery_position'];
mysqli_query($conn,"update tbl_gallery set gallery_position='$position' where gallery_id='$id'");
mysqli_query($conn,"update tbl_gallery set gallery_position='$bposition' where gallery_id='$bid'");
$_SESSION['banner-position-msg']="Updated Successfully";
?>
<script>window.location.href='add-gallery.php'</script>