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
|
<?php require("configure.php");
$CoursesCatId = $_GET["CoursesCatId"]; $CoursesDetailId = $_GET["CoursesDetailId"]; $sort = $_GET['sort']; $status = $_GET['status'];
if ($status == 'up') { $s_sign="+1"; $CoursesDetailSort = $sort-1; if ($CoursesDetailSort <=0) { $CoursesDetailSort = 1; } } else { $s_sign="-1"; $CoursesDetailSort = $sort+1; }
$sql = "update CoursesDetail set CoursesDetailSort='$CoursesDetailSort' "; $sql .= "where CoursesDetailId=". $CoursesDetailId ." and CoursesCatId=". $CoursesCatId ." ";
if( mysql_num_rows(mysql_query("SELECT CoursesDetailId FROM CoursesDetail WHERE CoursesDetailSort=$CoursesDetailSort AND CoursesDetailId!='$CoursesDetailId' AND CoursesCatId=$CoursesCatId ")) > 0){ mysql_query("UPDATE CoursesDetail SET CoursesDetailSort= CoursesDetailSort".$s_sign ." WHERE CoursesDetailSort =$CoursesDetailSort AND CoursesCatId=$CoursesCatId "); } mysql_query($sql); mysql_close($dbh);
header("Location: coursesdetail_index.php?CoursesCatId=$CoursesCatId&msg=Update Successful"); ?>
|