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
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php require_once('../inc/configure.php'); session_start(); if (!empty($_SESSION['webadmin'])) { $nowdate = date("Y-m-d H:i:s");
$category_ids = $_POST["category_id"]; $category_names = $_POST["category_name"]; $sort = $_POST["sort"];
foreach($category_ids as $category_id){ $sql = "update sup_task_category set category_name=?, sort=?, lastupdate=?, lastupby=? where task_category_id=?";
$parameters = array($category_names[$category_id],$sort[$category_id], $nowdate, $_SESSION['webadmin']['id'], $category_id); if (!($sth = $dbh->prepare($sql))) { throw new Exception("sql prepare statement failure: $sql"); } $sth->setFetchMode(PDO::FETCH_ASSOC); if (!$sth->execute($parameters)) { throw new Exception("sql execute statement failure: $sql"); } }
//delete this task category if (isset($_GET["delete_category"]) && $_GET["delete_category"] == 1) { $category_id = (int)$_GET["category_id"]; $sql = "update sup_task_category set deleted = 1 where task_category_id=?";
$parameters2 = array($category_id); if (!($sth = $dbh->prepare($sql))) { throw new Exception("sql prepare statement failure: $sql"); } $sth->setFetchMode(PDO::FETCH_ASSOC); if (!$sth->execute($parameters2)) { throw new Exception("sql execute statement failure: $sql"); } header("Location: category_index.php");
}
header("Location: category_index.php");
} ?>
|