|
|
|
ปัญหา โค้ดเยอะครับ ใครรู้วิธีที่ย่อ โค้ด นี้ ได้ บ้าง มัน เกี่ยวกับการหาค่่าเฉลี่ยครับ ผมเขียนนานละ คิดแล้วมันจะมีวิธีจะสั้นกว่านี้ |
|
|
|
|
|
|
|
Code (PHP)
<?php
session_start() ;
if(!session_is_registered("admin_login")) {
echo "<meta http-equiv=refresh content=2;url=teacher_login.php>" ;
exit() ;
}
?>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<?
include("config.php") ;
$course_id_now = $course_id;
$sec_now = $sec;
$sql="SELECT * FROM question" ;
$table=mysql_query($sql,$conn) or die;
$row=mysql_fetch_array($table);
$total=0;
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' ";
$result = mysql_query($query);
$total_true=mysql_result($result,0);
?>
<style type="text/css">
<!--
.style21 {color: #000000}
.style33 {
font-weight: bold;
color: #000000;
font-family: "Microsoft Sans Serif";
}
.style35 {font-size: 12px}
.style36 {font-size: 16px}
.style38 {color: #000000; font-size: 13px; }
.style39 {font-size: 13px; }
.style41 {font-size: 18px; }
-->
</style>
<body class="style33"><div align="center">
<p class="style41"><strong>รายงานแบบสอบถามความคิดเห็นของนักศึกษา </strong></p>
<p class="style41"><strong>เกี่ยวกับการสอนของอาจารย์ </strong></p>
<p class="style41">ภาคเรียนที่ 2/2553</p>
<p align="left" class="style39">ของ <? echo $PRENM; ?> <? echo $PONAME; ?> </p>
<p align="left" class="style39">วิชา <? echo $SJCODE; ?> <? echo $SUBJNAME; ?> SECTION <? echo $SECTION; ?> <? echo $TYPE; ?> </p>
<p align="left"><span class="style38">จำนวนนักศึกษาทั้งหมด <? echo $total_true; ?> คน
<?
$quest_check=0;
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and check1 = 1 ";
$result = mysql_query($query);
$total=mysql_result($result,0);
$percen= $total*100/$total_true
?>
<p align="left" class="style3 style5"><strong>มีผู้ตอบ<?echo $total;?></strong> <strong>คน คิดเป็น <?
printf("%.2f",$percen);
?> เปอร์เซ็นต์ จากนักศึกษาที่ลงทะเบียนวิชานี้ </strong></p>
<p align="left" class="style3 style5"> </p>
<?
if ($total==0)
$total=1;
?>
</span> </p>
</div>
<table width="705" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr class="style35">
<td width="417" height="23" class="style36"><div align="center" class="style38">รายละเอียด</div></td>
<td width="40" class="style36"><div align="center" class="style38">5</div></td>
<td width="40" class="style36"><div align="center" class="style38">4</div></td>
<td width="40" class="style36"><div align="center" class="style38">3</div></td>
<td width="40" class="style36"><div align="center" class="style38">2</div></td>
<td width="40" class="style36"><div align="center" class="style38">1</div></td>
<td width="64" class="style36"><div align="center" class="style38">คะแนนเฉลี่ย</div></td>
</tr>
<tr class="style35">
<td height="27" class="style38"> <img src="images/space.gif" width="11" height="8">1. อาจารย์อธิบายแนวการสอนของรายวิชาอย่างละเอียดและชัดเจน </td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques1=5 ";
$result = mysql_query($query);
$quest_1_5=mysql_result($result,0);
echo $quest_1_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques1=4 ";
$result = mysql_query($query);
$quest_1_4=mysql_result($result,0);
echo $quest_1_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques1=3 ";
$result = mysql_query($query);
$quest_1_3=mysql_result($result,0);
echo $quest_1_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques1=2 ";
$result = mysql_query($query);
$quest_1_2=mysql_result($result,0);
echo $quest_1_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques1=1 ";
$result = mysql_query($query);
$quest_1_1=mysql_result($result,0);
echo $quest_1_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum1= ($quest_1_1)+($quest_1_2*2)+($quest_1_3*3)+($quest_1_4*4)+($quest_1_5*5);
$mean_1=$mean_sum1/$total;
printf("%.2f",$mean_1);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="25" class="style38"><img src="images/space.gif" width="11" height="8">2. อาจารย์มีบุคลิกภาพและวางตัวได้อย่างเหมาะสม</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques2=5 ";
$result = mysql_query($query);
$quest_2_5=mysql_result($result,0);
echo $quest_2_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques2=4 ";
$result = mysql_query($query);
$quest_2_4=mysql_result($result,0);
echo $quest_2_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques2=3 ";
$result = mysql_query($query);
$quest_2_3=mysql_result($result,0);
echo $quest_2_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques2=2 ";
$result = mysql_query($query);
$quest_2_2=mysql_result($result,0);
echo $quest_2_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques2=1 ";
$result = mysql_query($query);
$quest_2_1=mysql_result($result,0);
echo $quest_2_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum2= ($quest_2_1)+($quest_2_2*2)+($quest_2_3*3)+($quest_2_4*4)+($quest_2_5*5);
$mean_2=$mean_sum2/$total;
printf("%.2f",$mean_2);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="25" class="style38"><img src="images/space.gif" width="11" height="8">3. อาจารย์เข้าสอนและเลิกสอนตรงเวลาอย่างสม่ำเสมอ</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques3=5 ";
$result = mysql_query($query);
$quest_3_5=mysql_result($result,0);
echo $quest_3_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques3=4 ";
$result = mysql_query($query);
$quest_3_4=mysql_result($result,0);
echo $quest_3_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques3=3 ";
$result = mysql_query($query);
$quest_3_3=mysql_result($result,0);
echo $quest_3_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques3=2 ";
$result = mysql_query($query);
$quest_3_2=mysql_result($result,0);
echo $quest_3_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques3=1 ";
$result = mysql_query($query);
$quest_3_1=mysql_result($result,0);
echo $quest_3_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum3= ($quest_3_1)+($quest_3_2*2)+($quest_3_3*3)+($quest_3_4*4)+($quest_3_5*5);
$mean_3=$mean_sum3/$total;
printf("%.2f",$mean_3);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="24" class="style38"><img src="images/space.gif" width="11" height="8">4. อาจารย์มีความตั้งใจและมุ่งมั่นในการสอน</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques4=5 ";
$result = mysql_query($query);
$quest_4_5=mysql_result($result,0);
echo $quest_4_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques4=4 ";
$result = mysql_query($query);
$quest_4_4=mysql_result($result,0);
echo $quest_4_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques4=3 ";
$result = mysql_query($query);
$quest_4_3=mysql_result($result,0);
echo $quest_4_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques4=2 ";
$result = mysql_query($query);
$quest_4_2=mysql_result($result,0);
echo $quest_4_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques4=1 ";
$result = mysql_query($query);
$quest_4_1=mysql_result($result,0);
echo $quest_4_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum4= ($quest_4_1)+($quest_4_2*2)+($quest_4_3*3)+($quest_4_4*4)+($quest_4_5*5);
$mean_4=$mean_sum4/$total;
printf("%.2f",$mean_4);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="24" class="style38"><img src="images/space.gif" width="11" height="8">5. อาจารย์มีความรู้ความเข้าใจในวิชาที่สอนเป็นอย่างดี</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques5=5 ";
$result = mysql_query($query);
$quest_5_5=mysql_result($result,0);
echo $quest_5_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques5=4 ";
$result = mysql_query($query);
$quest_5_4=mysql_result($result,0);
echo $quest_5_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques5=3 ";
$result = mysql_query($query);
$quest_5_3=mysql_result($result,0);
echo $quest_5_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques5=2 ";
$result = mysql_query($query);
$quest_5_2=mysql_result($result,0);
echo $quest_5_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques5=1 ";
$result = mysql_query($query);
$quest_5_1=mysql_result($result,0);
echo $quest_5_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum5= ($quest_5_1)+($quest_5_2*2)+($quest_5_3*3)+($quest_5_4*4)+($quest_5_5*5);
$mean_5=$mean_sum5/$total;
printf("%.2f",$mean_5);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="25" class="style38"><img src="images/space.gif" width="11" height="8">6. อาจารย์มีการใช้สื่อประกอบการสอนอย่างเหมาะสม</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques6=5 ";
$result = mysql_query($query);
$quest_6_5=mysql_result($result,0);
echo $quest_6_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques6=4 ";
$result = mysql_query($query);
$quest_6_4=mysql_result($result,0);
echo $quest_6_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques6=3 ";
$result = mysql_query($query);
$quest_6_3=mysql_result($result,0);
echo $quest_6_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques6=2 ";
$result = mysql_query($query);
$quest_6_2=mysql_result($result,0);
echo $quest_6_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques6=1 ";
$result = mysql_query($query);
$quest_6_1=mysql_result($result,0);
echo $quest_6_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum6= ($quest_6_1)+($quest_6_2*2)+($quest_6_3*3)+($quest_6_4*4)+($quest_6_5*5);
$mean_6=$mean_sum6/$total;
printf("%.2f",$mean_6);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="25" class="style38"><img src="images/space.gif" width="11" height="8">7. อาจารย์มีการสอดแทรกคุณธรรมจริยธรรมอย่างเหมาะสม</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques7=5";
$result = mysql_query($query);
$quest_7_5=mysql_result($result,0);
echo $quest_7_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques7=4";
$result = mysql_query($query);
$quest_7_4=mysql_result($result,0);
echo $quest_7_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques7=3";
$result = mysql_query($query);
$quest_7_3=mysql_result($result,0);
echo $quest_7_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques7=2";
$result = mysql_query($query);
$quest_7_2=mysql_result($result,0);
echo $quest_7_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques7=1";
$result = mysql_query($query);
$quest_7_1=mysql_result($result,0);
echo $quest_7_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum7= ($quest_7_1)+($quest_7_2*2)+($quest_7_3*3)+($quest_7_4*4)+($quest_7_5*5);
$mean_7=$mean_sum7/$total;
printf("%.2f",$mean_7);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="25" class="style38"><img src="images/space.gif" width="11" height="8">8. อาจารย์เปิดโอกาสให้ผู้เรียนมีส่วนร่วมในการเรียนการสอนอยู่เป็นประจำ</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques8=5";
$result = mysql_query($query);
$quest_8_5=mysql_result($result,0);
echo $quest_8_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques8=4";
$result = mysql_query($query);
$quest_8_4=mysql_result($result,0);
echo $quest_8_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques8=3";
$result = mysql_query($query);
$quest_8_3=mysql_result($result,0);
echo $quest_8_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques8=2";
$result = mysql_query($query);
$quest_8_2=mysql_result($result,0);
echo $quest_8_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques8=1";
$result = mysql_query($query);
$quest_8_1=mysql_result($result,0);
echo $quest_8_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum8= ($quest_8_1)+($quest_8_2*2)+($quest_8_3*3)+($quest_8_4*4)+($quest_8_5*5);
$mean_8=$mean_sum8/$total;
printf("%.2f",$mean_8);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="23" class="style38"><img src="images/space.gif" width="11" height="8">9. อาจารย์มีความเมตตา กรุณาและเอื้ออาธรต่อศิษย์โดยไม่เลือกปฏิบัติ </td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques9=5";
$result = mysql_query($query);
$quest_9_5=mysql_result($result,0);
echo $quest_9_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques9=4";
$result = mysql_query($query);
$quest_9_4=mysql_result($result,0);
echo $quest_9_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques9=3";
$result = mysql_query($query);
$quest_9_3=mysql_result($result,0);
echo $quest_9_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques9=2";
$result = mysql_query($query);
$quest_9_2=mysql_result($result,0);
echo $quest_9_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques9=1";
$result = mysql_query($query);
$quest_9_1=mysql_result($result,0);
echo $quest_9_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum9= ($quest_9_1)+($quest_9_2*2)+($quest_9_3*3)+($quest_9_4*4)+($quest_9_5*5);
$mean_9=$mean_sum9/$total;
printf("%.2f",$mean_9);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="23" class="style38"><img src="images/space.gif" width="11" height="8">10. อาจารย์จัดการเรียนการสอนที่สอดคล้องกับสถานการณ์ปัจจุบัน</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques10=5";
$result = mysql_query($query);
$quest_10_5=mysql_result($result,0);
echo $quest_10_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques10=4";
$result = mysql_query($query);
$quest_10_4=mysql_result($result,0);
echo $quest_10_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques10=3";
$result = mysql_query($query);
$quest_10_3=mysql_result($result,0);
echo $quest_10_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques10=2";
$result = mysql_query($query);
$quest_10_2=mysql_result($result,0);
echo $quest_10_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques10=1";
$result = mysql_query($query);
$quest_10_1=mysql_result($result,0);
echo $quest_10_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum10= ($quest_10_1)+($quest_10_2*2)+($quest_10_3*3)+($quest_10_4*4)+($quest_10_5*5);
$mean_10=$mean_sum10/$total;
printf("%.2f",$mean_10);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="23" class="style38"><img src="images/space.gif" width="11" height="8">11. อาจารย์ใช้วิธีการสอนและเทคนิคการสอนที่ก่อให้เกิดการเรียนรู้ได้เป็นอย่างดี</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques11=5";
$result = mysql_query($query);
$quest_11_5=mysql_result($result,0);
echo $quest_11_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques11=4";
$result = mysql_query($query);
$quest_11_4=mysql_result($result,0);
echo $quest_11_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques11=3";
$result = mysql_query($query);
$quest_11_3=mysql_result($result,0);
echo $quest_11_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques11=2";
$result = mysql_query($query);
$quest_11_2=mysql_result($result,0);
echo $quest_11_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques11=1";
$result = mysql_query($query);
$quest_11_1=mysql_result($result,0);
echo $quest_11_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum11= ($quest_11_1)+($quest_11_2*2)+($quest_11_3*3)+($quest_11_4*4)+($quest_11_5*5);
$mean_11=$mean_sum11/$total;
printf("%.2f",$mean_11);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="26" class="style38"><img src="images/space.gif" width="11" height="8">12. ความพึงพอใจในภาพรวมต่ออาจารย์ผู้สอน</td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques12=5";
$result = mysql_query($query);
$quest_12_5=mysql_result($result,0);
echo $quest_12_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques12=4";
$result = mysql_query($query);
$quest_12_4=mysql_result($result,0);
echo $quest_12_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques12=3";
$result = mysql_query($query);
$quest_12_3=mysql_result($result,0);
echo $quest_12_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques12=2";
$result = mysql_query($query);
$quest_12_2=mysql_result($result,0);
echo $quest_12_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$query = "select count(student_id) from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' and ques12=1";
$result = mysql_query($query);
$quest_12_1=mysql_result($result,0);
echo $quest_12_1;
?>
</div></td>
<td align="center" class="style39">
<span class="style21">
<?
$mean_sum12= ($quest_12_1)+($quest_12_2*2)+($quest_12_3*3)+($quest_12_4*4)+($quest_12_5*5);
$mean_12=$mean_sum12/$total;
printf("%.2f",$mean_12);
?>
</span>
<div align="center" class="style21"></div></td>
</tr>
<tr class="style35">
<td height="22" class="style38"><img src="images/space.gif" width="11" height="8">รวม</td>
<td class="style36"><div align="center" class="style38">
<?
$quest_sum_5 = $quest_1_5 + $quest_2_5 + $quest_3_5 + $quest_4_5 + $quest_5_5 + $quest_6_5 + $quest_7_5 + $quest_8_5 + $quest_9_5 + $quest_10_5 + $quest_11_5 + $quest_12_5;
echo $quest_sum_5;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$quest_sum_4 = $quest_1_4 + $quest_2_4 + $quest_3_4 + $quest_4_4 + $quest_5_4 + $quest_6_4 + $quest_7_4 + $quest_8_4 + $quest_9_4 + $quest_10_4 + $quest_11_4 + $quest_12_4;
echo $quest_sum_4;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$quest_sum_3 = $quest_1_3 + $quest_2_3 + $quest_3_3 + $quest_4_3 + $quest_5_3 + $quest_6_3 + $quest_7_3 + $quest_8_3 + $quest_9_3 + $quest_10_3 + $quest_11_3 + $quest_12_3;
echo $quest_sum_3;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$quest_sum_2 = $quest_1_2 + $quest_2_2 + $quest_3_2 + $quest_4_2 + $quest_5_2 + $quest_6_2 + $quest_7_2 + $quest_8_2 + $quest_9_2 + $quest_10_2 + $quest_11_2 + $quest_12_2;
echo $quest_sum_2;
?>
</div></td>
<td class="style36"><div align="center" class="style38">
<?
$quest_sum_1 = $quest_1_1 + $quest_2_1 + $quest_3_1 + $quest_4_1 + $quest_5_1 + $quest_6_1 + $quest_7_1 + $quest_8_1 + $quest_9_1 + $quest_10_1 + $quest_11_1 + $quest_12_1;
echo $quest_sum_1;
?>
</div></td>
<td align="center" class="style36"><div align="center" class="style38">
<?
$mean_all = $mean_1 + $mean_2 + $mean_3 + $mean_4 + $mean_5 + $mean_6 + $mean_7 + $mean_8 + $mean_9 + $mean_10 + $mean_11 + $mean_12;
$mean_all_average = $mean_all/12;
printf("%.2f",$mean_all_average);
?>
</div></td>
</tr>
</table>
<p> </p>
<p class="style21"><span class="style39"><strong>ผลการประเมินเฉลี่ย</strong>
<?
printf("%.2f",$mean_all_average);
?>
อยู่ในระดับ
<?
if ($mean_all_average>=4.51)
echo "อยู่ในระดับ ปฏิบัติทุกครั้ง หรือ มีประสิทธิภาพสูงมาก";
else if ($mean_all_average>=3.51)
echo "อยู่ในระดับ ปฏิบัติเกือบทุกครั้ง หรือมีประสิทธิภาพสูง";
else if ($mean_all_average>=2.51)
echo "อยู่ในระดับปฏิบัติประมาณครึ่งหนึ่ง หรือมีประสิทธิภาพปานกลาง";
else if ($mean_all_average>=1.51)
echo "อยู่ในระดับปฏิบัติเป็นบางครั้ง หรือ มีประสิทธิภาพน้อย";
else echo "อยู่ในระดับไม่ได้ปฏิบัติ หรือมีประสิทธิภาพน้อยมาก";
?>
</span></p>
<p class="style38">ข้อเสนอแนะอื่นๆ</p>
<table width="733" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="667" class="style36">
<span class="style39">
<?php
$sql="select * from question where PONAME='$PONAME' and SJCODE='$SJCODE' and SECTION='$SECTION' and TYPE='$TYPE' ";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
$etc=$row["ect"];
$a++;
if ($etc != null)
// echo $etc;
{
echo "- " ;
echo $etc ;
echo "<br>" ;
}
}
mysql_close($conn);
?>
</span >
</td>
</tr>
</table>
Tag : PHP, MySQL
|
ประวัติการแก้ไข 2011-06-07 10:22:10
|
|
|
|
|
Date :
2011-06-07 10:21:25 |
By :
ckcr |
View :
847 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จะช่วยยังไงดีครับ Query เยอะมาก
|
|
|
|
|
Date :
2011-06-07 10:35:31 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
นี้แหละครับ เยอะ
ผม ว่าน่าจะมีวิธี Query น้อยแล้วกว่านี้ สักหน่อย
แสดงผลประมาณนี้
|
|
|
|
|
Date :
2011-06-07 10:57:00 |
By :
ckcr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เพราะต้อง ดึง ข้อ1 เลือก 5 กี่คน
และแต่ละช่องใช้คนละ query กัน เลย เงื่อนไข
พอจะมีวิธีอื่นไมครับ
มันจะเป็น report การหาค่าเฉลี่ย แบบ โปรแกรม spss ครับ
ที่จะมี
คะแนน 4.21 – 5.00 หมายถึง บริการมีความพึงพอใจในระดับมากที่สุด
คะแนน 3.41 - 4.20 หมายถึง บริการมีความพึงพอใจในระดับมาก
คะแนน 2.61 – 3.40 หมายถึง บริการมีความพึงพอใจในระดับปานกลาง
คะแนน 1.81 – 2.60 หมายถึง บริการมีความพึงพอใจในระดับนอย
คะแนน 1.00 – 1.80 หมายถึง ใชบริการมีความพึงพอใจในระดับนอยที่สุด
สรุปอีกที่ครับ
|
|
|
|
|
Date :
2011-06-07 11:04:18 |
By :
ckcr |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|