/var/www/airchats.com.hk/webadmin/prodcat_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
29
30
31
<?php require("configure.php"); 

$parentid     $_GET['parentid'];
$catid         $_GET['catid'];
$sort              $_GET['sort'];
$status       $_GET['status'];

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

$sql "update prodcategory set catsort='$catsort' ";
$sql .= "where catid="$catid ." ";

if( 
mysql_num_rows(mysql_query("SELECT catid FROM prodcategory WHERE parentid=$parentid AND catsort=$catsort AND catid!='$catid'")) > 0){
    
mysql_query("UPDATE prodcategory SET catsort= catsort".$s_sign ." WHERE parentid=$parentid AND catsort =$catsort");
}
mysql_query($sql);


mysql_close($dbh);

header("Location: prodcat_index.php?pid=$parentid&msg=Update Successful");
?>