/var/www/(Del)discoverylearning.com.hk/webadmin/gallerycat_sort.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php require("configure.php"); 

$GalleryCatId   $_GET['GalleryCatId'];
$sort              $_GET['sort'];
$status           $_GET['status'];

if (
$status == 'up') {
    
$s_sign="+1";
    
$GalleryCatSort $sort-1;
    if (
$GalleryCatSort <=0) {
        
$GalleryCatSort 1;
        }
} else {
$s_sign="-1";
    
$GalleryCatSort $sort+1;
}

$sql "update GalleryCat set GalleryCatSort='$GalleryCatSort' ";
$sql .= "where GalleryCatId="$GalleryCatId ." ";
//echo $sql;
if( mysql_num_rows(mysql_query("SELECT GalleryCatId FROM GalleryCat WHERE GalleryCatSort=$GalleryCatSort AND GalleryCatId!='$GalleryCatId' ")) > 0){
    
mysql_query("UPDATE GalleryCat SET GalleryCatSort= GalleryCatSort".$s_sign ." WHERE GalleryCatSort = $GalleryCatSort ");
}
mysql_query($sql);
mysql_close($dbh);

header("Location: gallerycat_index.php?msg=Update Successful");
?>