|
เลือกปีการศึกษา
mysql_query("set NAMES tis620");
if(isset($_GET['year'])) //ถ้าเป็นการเลือกปีครั้งใหม่
{
$txtyear = $_GET['year'];
if($txtyear =='0000') //แสดงทั้งหมด
{
$sql = ("SELECT App_GPAX from applicants");
}
else
{
$sql = ("SELECT App_GPAX from applicants where App_year = '$txtyear'");
}
}
else
{
$sql = ("SELECT App_GPAX from applicants");
}
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
$i = 0;
$num1 = 0;
$num2 = 0;
$num3 = 0;
$num4 = 0;
$num5 = 0;
while ($i < $num_rows) {
$fetcharr = mysql_fetch_array($result);
$gpa = $fetcharr['App_GPAX'];
if ($gpa >= '0.0' && $gpa <= '2.0')
$num1++;
elseif ($gpa > '2.0' && $gpa <= '2.5')
$num2++;
elseif ($gpa > '2.5' && $gpa <= '3.0')
$num3++;
elseif ($gpa > '3.0' && $gpa <= '3.5')
$num4++;
elseif ($gpa > '3.5' && $gpa <= '4.0')
$num5++;
$i++;
}
?> |