 |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ข้อมูลนักเรียน</title>
<style type="text/css">
@media print {
.no-print {
display:none;
}
}
</style>
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="1000"cellspacing="0" cellpadding="0" align="center" border="0">
<tr>
<td ><div align="right">
<div class="no-print">Year :</div>
</div></td>
<td><div class="no-print">
<select name="txtKeyword">
<OPTION VALUE="" >--select--</OPTION>
<OPTION value="2012"<?if ($_GET["txtKeyword"]==2012) echo 'selected="selected"';?>>2012</OPTION>
<OPTION value="2013"<?if ($_GET["txtKeyword"]==2013) echo 'selected="selected"';?>>2013</OPTION>
<OPTION value="2014"<?if ($_GET["txtKeyword"]==2014) echo 'selected="selected"';?>>2014</OPTION>
<OPTION value="2015"<?if ($_GET["txtKeyword"]==2015) echo 'selected="selected"';?>>2015</OPTION>
<OPTION value="2016"<?if ($_GET["txtKeyword"]==2016) echo 'selected="selected"';?>>2016</OPTION>
<OPTION value="2017"<?if ($_GET["txtKeyword"]==2017) echo 'selected="selected"';?>>2017</OPTION>
<OPTION value="2018"<?if ($_GET["txtKeyword"]==2018) echo 'selected="selected"';?>>2018</OPTION>
<OPTION value="2019"<?if ($_GET["txtKeyword"]==2019) echo 'selected="selected"';?>>2019</OPTION>
<OPTION value="2020"<?if ($_GET["txtKeyword"]==2020) echo 'selected="selected"';?>>2020</OPTION>
<OPTION value="2021"<?if ($_GET["txtKeyword"]==2021) echo 'selected="selected"';?>>2021</OPTION>
<OPTION value="2022"<?if ($_GET["txtKeyword"]==2022) echo 'selected="selected"';?>>2022</OPTION>
</select>
<input type="submit" value="Search">
</div></td>
</tr>
</table>
</form>
<?
if($_GET["txtKeyword"] != "")
{$sumtotal_zone=0;
include("../../include/php/connect.php");
// Search By Name or Email
$strSQL= "SELECT DISTINCT f.zone_name
FROM student a,school b,class c,prefix d,province e,zone f
where
a.prefix_id=d.prefix_id and
a.school_id=b.school_id and
a.class_id=c.class_id and
b.province_id=e.province_id and
e.zone_id=f.zone_id and
a.year_id LIKE '%".$_GET["txtKeyword"]."%'
order by a.student_id desc ";
// $strSQL = "SELECT * FROM student WHERE (year_id LIKE '%".$_GET["txtKeyword"]."%' ) ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
?>
<?
?>
</div>
<table cellspacing="0" cellpadding="0" width="1200" border='0' align="center">
<?
while($objResult = mysql_fetch_array($objQuery))
{$zone_name=$objResult["zone_name"];
$sumtotal_zone= $sumtotal_zone+1;
?>
<tr >
<th colspan="9" scope="row"><div align="left">
<h3>
<?=$zone_name?>
</h3>
</div></th>
</tr>
<?
//**********************
?>
<?
{$school_i=0;
$sql5= "SELECT DISTINCT b.school_name
FROM student a,school b,class c,prefix d,province e,zone f
where
a.prefix_id=d.prefix_id and
a.school_id=b.school_id and
a.class_id=c.class_id and
b.province_id=e.province_id and
e.zone_id=f.zone_id and
a.year_id LIKE '%".$_GET["txtKeyword"]."%' and
f.zone_name='$zone_name'
order by a.student_id desc ";
$result5=mysql_query($sql5) or die ($sql5.mysql_error());
// echo $sql5;
// exit;
while($rows5=mysql_fetch_array($result5))
{
$school_name=$rows5["school_name"];
{
$color='#ffffff';
}
$school_i= $school_i+1;
{
?>
<tr height="35">
<th colspan="9" scope="row"><div align="left">
<?=$school_i?>
.
<?=$school_name?>
</div></th>
</tr>
<?
//*******************************************************************************************************
?>
<tr class="Caption"bgcolor="#919192" height="35" >
<th width="100" ><div align="center">No</div></th>
<th width="50"><div align="center">Class</div></th>
<th width="100"><div align="center">Date of Birth</div></th>
<th width="300"><div align="center">Name-Surname</div></th>
<th width="100"><div align="center">Mobile phone</div></th>
<th width="200"><div align="center">E-mail</div></th>
<th width="200"><div align="center">Facebook</div></th>
<th width="150" ><div align="center">Twitter</div></th>
</tr>
<?
{$student_i=0;
$school_ii=0;
$sum_schooli=0;
$sql3= "SELECT a.*,b.school_name,c.class_name,d.prefix_name,e.province_name,f.zone_name
FROM student a,school b,class c,prefix d,province e,zone f
where
a.prefix_id=d.prefix_id and
a.school_id=b.school_id and
a.class_id=c.class_id and
b.province_id=e.province_id and
e.zone_id=f.zone_id and
a.year_id LIKE '%".$_GET["txtKeyword"]."%' and
b.school_name='$school_name' and
f.zone_name='$zone_name'
order by a.student_id desc ";
$result3=mysql_query($sql3) or die ($sql3.mysql_error());
// echo $sql3;
// exit;
while($rows3=mysql_fetch_array($result3))
{
$student_id=$rows3["student_id"];
$number_id=$rows3["number_id"];
$school_name=$rows3["school_name"];
$class_name=$rows3["class_name"];
$date_of_birth=$rows3["date_of_birth"];
$prefix_name=$rows3["prefix_name"];
$name=$rows3["name"];
$surname=$rows3["surname"];
$mobile=$rows3["mobile"];
$email=$rows3["email"];
$facebook_id=$rows3["facebook_id"];
$twitter_id=$rows3["twitter_id"];
{
$color='#ffffff';
}
$student_i= $student_i+1;
$school_ii= $school_ii+1;
{
?>
<tr bgcolor="#ffffff" onmouseover='this.bgColor = "#DDDDDD"' onmouseout='this.bgColor = "#ffffff"'>
<td><div align="center">
<?=$number_id?>
</div></td>
<td><div align="center">
<?=$class_name?>
</div></td>
<td><div align="center">
<?=$date_of_birth?>
</div></td>
<td><?=$prefix_name?>
<?=$name?>
<?=$surname?></td>
<td><div align="center">
<?=$mobile?>
</div></td>
<td><?=$email?></td>
<td><?=$facebook_id?></td>
<td><?=$twitter_id?></td>
</tr>
<?
}
}
?>
<tr bgcolor="#cccccc" onmouseover='this2.bgColor = "#DDDDDD"' onmouseout='this2.bgColor = "#ffffff"'>
<th colspan="9" scope="row"><div align="right">รวม
<?=$student_i ?>
คน</div></th>
</tr>
<?
}$sum_student = $student_i;
$sumtotal_student = $sumtotal_student + $sum_student;
$sum_schooli = $school_ii;
$sumtotal_schooli = $sumtotal_schooli + $sum_schooli;
?>
<? ?>
<?
//****************************************************************************************************************
}
}
?>
<tr onmouseover='this2.bgColor = "#DDDDDD"' onmouseout='this2.bgColor = "#ffffff"'>
<th colspan="9" scope="row" ><div align="right">สรุป
<?=$zone_name?>
</div></th>
</tr>
<tr onmouseover='this2.bgColor = "#DDDDDD"' onmouseout='this2.bgColor = "#ffffff"'>
<th colspan="9" scope="row" ><div align="right">
<?=$school_i ?>
โรงเรียน</div></th>
</tr>
<?
}$sum_school = $school_i;
$sumtotal_school = $sumtotal_school + $sum_school;
?>
<tr >
<th colspan="9" scope="row"><div align="right">
<?=$sumtotal_schooli?>
คน</div></th>
</tr>
<? $sumtotal_schooli=0;
?>
<div style="page-break-after: always"></div>
<?
//***************************************************************************************************************
}
?>
<tr>
<th colspan="9" scope="row"><div align="right"></th>
</tr>
<tr>
<th colspan="9" scope="row"><div align="right">รวมทั้งหมด
<?=$sumtotal_zone ?>
ภาค</div></th>
</tr>
<tr>
<th colspan="9" scope="row"><div align="right">รวมทั้งหมด
<?=$sumtotal_school ?>
โรงเรียน</div></th>
</tr>
<tr>
<th colspan="9" scope="row"><div align="right">รวมทั้งหมด
<?=$sumtotal_student ?>
คน</div></th>
</tr>
<?
?>
</table>
<input type="image" src="images/print.gif" id=button1 name=button1 onClick="window.print()">
<?
mysql_close($objConnect);
}
Tag : PHP, MySQL, Report Others
|
ประวัติการแก้ไข 2012-09-21 15:20:49 2012-09-21 15:47:21 2012-09-21 15:48:07
|
 |
 |
 |
 |
Date :
2012-09-21 14:36:03 |
By :
winnie |
View :
1358 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |