/var/www/(Del)pathways.org.hk/MIS20140127/old20140414/LeaveApplication/unused/Cancel_Lesson.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php

include_once '../../include/DBConnect.php';

if (
$_POST) {
    
//echo '<script>alert("$_POST" )</script>';
    
$score $_POST['Data'];
    
$UpdateLeaveRecordID $_POST['Data'];

    if (isset(
$_POST['Action'])) {
        
$CurrentAction $_POST['Action'];
        
        
        
$query "UPDATE `lesson_attendance` SET `is_cancel` = 1  WHERE `lesson_id` = '$UpdateLeaveRecordID' and deleted =0 and actived = 1";
        
$sth $dbh -> prepare($query);
        
$sth->execute();
//        if ($CurrentAction == 1) {
//            $sth = $dbh->prepare("UPDATE `leave_lesson` SET `actived` = '0' WHERE `lesson_id` = '$UpdateLeaveRecordID' AND `actived` = '1'");
//            $sth->execute();
//        }
//        if ($CurrentAction == 2) {
//            $sth = $dbh->prepare("UPDATE `leave_lesson` SET `actived` = '1' WHERE `lesson_id` = '$UpdateLeaveRecordID' AND `actived` = '0'");
//            $sth->execute();
//        }
    
}
    
    if (
$sth)
        
$message "1 record UPDATED";
    else
        
$message "Error";

    
$Array = array(
        
"1" => $message,
        
"2" => $score 2,
        
"3" => $score 3,
        
"4" => $score 4,
        
"5" => $UpdateLeaveRecordID
    
);
    
$Arrays[] = $Array;
}
//echo $score;
echo json_encode($Arrays);
?>