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");
$ProductGradeId = $_GET['ProductGradeId']; $ProductCatId = $_GET["ProductCatId"]; $Sort = $_GET['Sort']; $status = $_GET['status'];
if ($status == 'up') { $s_sign="+1"; $PCSort = $Sort-1; if ($PCSort <=0) { $PCSort = 1; } } else { $s_sign="-1"; $PCSort = $Sort+1; }
$sql = "update ProductGrade set Sort='$PCSort' "; $sql .= "where ProductGradeId=". $ProductGradeId ." "; //echo $sql; if( mysql_num_rows(mysql_query("SELECT ProductGradeId FROM ProductGrade WHERE Sort=$PCSort AND ProductGradeId!='$ProductGradeId' ")) > 0){ mysql_query("UPDATE ProductGrade SET Sort= Sort".$s_sign ." WHERE ProductCatId= $ProductCatId AND Sort = $PCSort "); } mysql_query($sql); mysql_close($dbh); //echo "<br><br>UPDATE ProductGrade SET Sort= Sort".$s_sign ." WHERE ProductCatId= $ProductCatId AND Sort = $PCSort";
header("Location: productgrade_index.php?msg=Update Successful"); ?>
|