/var/www/onesolution.com.hk/onesupport/task/category_add.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
<?php
    
require_once('../inc/configure.php');
    
session_start();
    if(!empty(
$_SESSION['webadmin'])){
        
$nowdate date("Y-m-d H:i:s");
        if(isset(
$_GET["addcategory"]) && $_GET["addcategory"] ==1){

            
$sql "insert into sup_task_category (lastupby, lastupdate) values (?, ?) ";

            
$parameters = array($_SESSION['webadmin']['id'],$nowdate);
            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");
            }

            
$lastinsertid $dbh->lastInsertId();

        }
        
header("Location: category_index.php?message=New empty category created." );
    }
?>