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
32
|
<?php include_once ("check_login.php");
$parentid = (int)$_GET["parentid"]; $categoryid = (int)$_GET["categoryid"]; $nowdate = date("Y-m-d H:i:s");
$sql = "select * from pro_category where categoryid = ?"; $parameters = array($categoryid); $pro_category_info = bind_pdo($sql, $parameters, "selectone"); $current_status = $pro_category_info{"status"};
//update related status of this category $sql = "update pro_category set status=case when status = 1 then 0 else 1 end, lastupdate=?, lastupby=? where categoryid=?"; $parameters = array($nowdate, (int)$_SESSION['cmsloginid'], $categoryid); bind_pdo($sql, $parameters);
if ($current_status == 1) { $new_status = 0; } else { $new_status = 1; } //update related status of this category $sql = "update pro_category set status=?, lastupdate=?, lastupby=? where parentid=?"; $parameters = array($new_status, $nowdate, (int)$_SESSION['cmsloginid'], $categoryid); bind_pdo($sql, $parameters);
$dbh = null;
header("Location: product_category_index.php?pid=$parentid&msg=Update Successfully"); ?>
|