01.
<?
02.
03.
if
(
$_POST
[
'Submit'
]==
"ประเมิน"
){
04.
echo
"<font color=\"red\">บันทึกเรียบร้อย</font>"
;
05.
{
06.
for
(
$i
=1;
$i
<=
$_POST
[
"hdnLine"
];
$i
++)
07.
{
08.
$strSQL
=
"UPDATE test_sub SET "
;
09.
$strSQL
.=
"score1 = '"
.
$_POST
[
"score1$i"
].
"' "
;
10.
$strSQL
.=
"score2 = '"
.
$_POST
[
"score2$i"
].
"' "
;
11.
$strSQL
.=
"score3 = '"
.
$_POST
[
"score3$i"
].
"' "
;
12.
$strSQL
.=
"score4 = '"
.
$_POST
[
"score4$i"
].
"' "
;
13.
$strSQL
.=
"score5 = '"
.
$_POST
[
"score5$i"
].
"' "
;
14.
$strSQL
.=
"score6 = '"
.
$_POST
[
"score6$i"
].
"' "
;
15.
$strSQL
.=
"score7 = '"
.
$_POST
[
"score7$i"
].
"' "
;
16.
$strSQL
.=
"score8 = '"
.
$_POST
[
"score8$i"
].
"' "
;
17.
$strSQL
.=
"score9 = '"
.
$_POST
[
"score9$i"
].
"' "
;
18.
$strSQL
.=
"score10 = '"
.
$_POST
[
"score10$i"
].
"' "
;
19.
$strSQL
.=
"midterm = '"
.
$_POST
[
"midterm$i"
].
"' "
;
20.
$strSQL
.=
"final = '"
.
$_POST
[
"final$i"
].
"' "
;
21.
$strSQL
.=
"WHERE num_test = '"
.
$_POST
[
"num_test$i"
].
"' "
;
22.
}
23.
24.
25.
}
26.
$strSQL
= "SELECT test_sub.num_test,test_sub.Stu_ID, student.Stu_Name, student.Stu_LName, student.Stu_Clase, student.Stu_Room, test_sub.num_sub_id, subject_c.sub_id, subject_c.name_subject, subject_c.TeacherID, teacher.TeacherName, teacher.TeacherLName, test_sub.score1, test_sub.score2, test_sub.score3, test_sub.score4, test_sub.score5, test_sub.score6, test_sub.score7, test_sub.score8, test_sub.score9, test_sub.score10, test_sub.midterm, test_sub.final, test_sub.memo
27.
FROM student INNER JOIN ((teacher INNER JOIN subject_c ON teacher.TeacherID = subject_c.TeacherID) INNER JOIN test_sub ON subject_c.num_sub_id = test_sub.num_sub_id) ON student.Stu_ID = test_sub.Stu_ID ORDER BY num_test ASC";
28.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
29.
}
30.
?>