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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
<?php include_once '../include/DBConnect.php'; $old_id=$_POST['old_stu_id']; $new_id=$_POST['new_stu_id']; $sem_yr=$_POST['sem_yr']; $input_by=$_POST['input_by']; $input_date=$_POST['input_date'];
$is_actived=$_POST['is_actived']; $app_date=$_POST['app_date']; $reg_date=$_POST['reg_date']; if(isset($_POST['is_pathway_stu'])) $is_pathway_stu=$_POST['is_pathway_stu']; else $is_pathway_stu=0; if(isset($_POST['is_in_school'])) $is_in_school=$_POST['is_in_school']; else $is_in_school=0; $reg_num=$_POST['reg_num']; $reg_campus=$_POST['reg_campus']; $reg_sem_yr=$_POST['reg_sem_yr']; $last_name=$_POST['last_name']; $first_name=$_POST['first_name']; $ch_name=$_POST['ch_name']; $gender=$_POST['gender']; $date_of_birth=$_POST['date_of_birth']; $home_tel=$_POST['home_tel']; $fax=$_POST['fax']; $email=$_POST['email']; $address=$_POST['address']; $district=$_POST['district']; $school_name=$_POST['school_name']; $grade=$_POST['grade']; $photo=$_POST['photo'];
$father_name=$_POST['father_name']; $father_occ=$_POST['father_occ']; $father_mobile=$_POST['father_mobile']; $father_off_tel=$_POST['father_off_tel'];
$mother_name=$_POST['mother_name']; $mother_occ=$_POST['mother_occ']; $mother_mobile=$_POST['mother_mobile']; $mother_off_tel=$_POST['mother_off_tel'];
$Guard_name=$_POST['guard_name']; $Guard_occ=$_POST['guard_occ']; $Guard_relationship=$_POST['guard_relationship']; $Guard_tel_home=$_POST['guard_tel_home']; $guard_mobile=$_POST['guard_mobile']; $guard_off_tel=$_POST['guard_off_tel'];
$eme_name=$_POST['eme_name']; $eme_contact_no=$_POST['eme_contact_no']; $eme_relationship=$_POST['eme_relationship'];
$refer_by=$_POST['refer_by']; $other_refer_by=$_POST['other_refer_by']; $assessed_by=$_POST['assessed_by']; $other_assessed_by=$_POST['other_assessed_by']; $remarks=$_POST['remarks']; $medication=$_POST['medication'];
$get_root="Select root_id as r from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr'"; $r_get_root=$dbh->query($get_root); $r_get_root->setFetchMode(PDO::FETCH_OBJ); $row=$r_get_root->fetch(); /**/ $query="Update student set deleted='1' where New_stu_ID='$new_id' and Sem_yr='$sem_yr'"; $result=$dbh->query($query); $query2="Update student_grade set deleted='1' where student_grade_id IN (Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and deleted='1')"; $result2=$dbh->query($query2); $query4="Update student_subsidy set deleted='1' where stu_subsidy_id IN (Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and deleted='1')"; $result4=$dbh->query($query4); $query10="Update student_diagnose set deleted='1' where stu_dia_ID IN (Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and deleted='1')"; $result4=$dbh->query($query10); $query11="Update student_additional_aspect set deleted='1' where stu_add_ID IN (Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and deleted='1')"; $result4=$dbh->query($query11);
$query1="Insert into student set New_stu_ID='$new_id', Old_stu_ID='$old_id', Sem_yr='$sem_yr', root_id='$row->r', createby='$input_by', createdate=Now(), lastupby=0, lastupdate=Now(), actived='$is_actived', deleted=0, reg_campus_id='$reg_campus', input_date='$input_date', application_date='$app_date', registration_date='$reg_date', is_pathway_student='$is_pathway_stu', is_in_school_student='$is_in_school',registration_number='$reg_num', reg_sem_year='$reg_sem_yr',last_name='$last_name', first_name='$first_name', ch_name='$ch_name', gender='$gender', date_of_birth='$date_of_birth', home_tel='$home_tel', fax='$fax', email='$email', photo='$photo', address='$address', district_id='$district',school_name='$school_name', father_name='$father_name', father_occupation='$father_occ', father_mobile='$father_mobile', father_off_tel='$father_off_tel', mother_name='$mother_name', mother_occupation='$mother_occ', mother_mobile='$mother_mobile', mother_off_tel='$mother_off_tel', guardian_name='$Guard_name', guardian_occupation='$Guard_occ', guardian_relationship='$Guard_relationship', guardian_mobile='$guard_mobile', guardian_home_tel='$Guard_tel_home', guardian_off_tel='$guard_off_tel', eme_contact_name='$eme_name', eme_contact_number='$eme_contact_no', eme_contact_relationship='$eme_relationship', remarks='$remarks', ch_assessment_ID=NULL, ch_assessment_date=NULL, en_assessment_ID=NULL, en_assessment_date=NULL, math_assessment_ID=NULL, math_assessment_date=NULL, medication='$medication'"; $result1=$dbh->query($query1); $query3="Insert into student_grade set student_grade_id=(Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(), lastupby=0, lastupdate=Now(), actived=1, deleted=0,grade_id='$grade'"; $result3=$dbh->query($query3); if (isset($_POST['subsidy_get'])) { for ($i = 0; $i < count($_POST['subsidy_get']); $i++) { $subsidy_get = $_POST['subsidy_get'][$i]; $query5 = "Insert into student_subsidy set stu_subsidy_id=(Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(), lastupby=0, lastupdate=Now(), actived=1, deleted=0,subsidy_id='$subsidy_get'"; $result5 = $dbh->query($query5); if (!$result2) { echo "<script>alert('Error 1.')</script>"; } } }
if (isset($_POST['diagnose'])) { for ($i = 0; $i < count($_POST['diagnose']); $i++) { $diagnose = $_POST['diagnose'][$i]; $query3 = "Insert into student_diagnose set stu_dia_ID=(Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(), lastupby=0, lastupdate=Now(), actived=1, deleted=0,diagnose_id='$diagnose',refer_by='$refer_by',other_refer_by='$other_refer_by'"; $result3 = $dbh->query($query3); if (!$result3) { echo "<script>alert('Error 3.')</script>"; } } } if (isset($_POST['add_aspect'])) { for ($i = 0; $i < count($_POST['add_aspect']); $i++) { $add_aspect = $_POST['add_aspect'][$i]; //add_aspect $query4 = "Insert into student_additional_aspect set stu_add_ID=(Select linking_id from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr' and lastupdate=(Select MAX(lastupdate) from student where New_stu_ID='$new_id' and Sem_yr='$sem_yr')),createby='$input_by', createdate=Now(), lastupby=0, lastupdate=Now(), actived=1, deleted=0,aspect_id='$add_aspect',assessed_by='$assessed_by',other_assessed_by='$other_assessed_by'"; $result4 = $dbh->query($query4); if (!$result4) { echo "<script>alert('Error 4.')</script>"; } } } if($result&&$result1&&$result2&&$result3&&$result4){ echo "<script>alert('Update data successful.')</script>"; echo("<script>location.href ='student.php';</script>"); } ?>
|