function add(){
$conn = new mysqli("localhost", "root", "Treegrid","tgrid");
$json_del=file_get_contents("php://input");
$obj_del = json_decode($json_del,true);
$key=(int)$obj_del['taskID'];
$name=(string)$obj_del['taskName'];
$startDate=(string)$obj_del['startDate'];
$endDate=(string)$obj_del['endDate'];
$duration=(string)$obj_del['duration'];
$Progress=(string)$obj_del['Progress'];
if((string)$obj_del['parentID']){
$parentID=(string)$obj_del['parentID'];
echo json_encode($parentID);
$retval = mysqli_query($conn,"INSERT INTO gantt (taskID, taskName,startDate,endDate,duration,Progress,parentID)
VALUES ('$key', '$name','$startDate','$endDate','$duration','$Progress','$parentID')");
echo json_encode($retval);
}
else{
$retval = mysqli_query($conn,"INSERT INTO gantt (taskID, taskName,startDate,endDate,duration,Progress)
VALUES ('$key', '$name','$startDate','$endDate','$duration','$Progress')");
echo json_encode($retval);
}
} |