01.
<?php
02.
ob_start();
03.
include
"connect.php"
;
04.
?>
05.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
06.
<?
07.
$ques_num
=1;
08.
$sql
=
"select * from question where ex_id = '1' order by ques_id LIMIT 0,10"
;
09.
$db_query
= mysql_query(
$sql
)
or
die
(
"Select error"
);
10.
$count
= mysql_num_rows(
$db_query
);
11.
12.
if
(
$count
!=10)
13.
{
14.
echo
"<center>ขออภัยค่ะ ขณะนี้ยังไม่สามารถเข้าทำแบบทดสอบในบทเรียนนี้ได้ค่ะ</center>"
;
15.
}
16.
else
17.
{
18.
while
(
$r
=mysql_fetch_array(
$db_query
))
19.
{
20.
$qid
=
$r
[ques_id];
21.
$ques
=
$r
[question];
22.
$c1
=
$r
[choice1];
23.
$c2
=
$r
[choice2];
24.
$c3
=
$r
[choice3];
25.
$c4
=
$r
[choice4];
26.
echo
"<font
class
=
'font'
size=
'2pt'
><B>ข้อ
$qid
.
$ques
</B><BR>
27.
<INPUT TYPE=
'radio'
NAME=
'select_$id'
VALUE=
'1'
>
$c1
<BR>
28.
<INPUT TYPE=
'radio'
NAME=
'select_$id'
VALUE=
'2'
>
$c2
<BR>
29.
<INPUT TYPE=
'radio'
NAME=
'select_$id'
VALUE=
'3'
>
$c3
<BR>
30.
<INPUT TYPE=
'radio'
NAME=
'select_$id'
VALUE=
'4'
>
$c4
</font>
31.
<HR>";
32.
}
33.
}
34.
mysql_close();
35.
ob_end_flush();
36.
?>