<?php require_once('../Connections/edu_system.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
mysql_select_db($database_edu_system, $edu_system);
$query_admin_sys = "SELECT * FROM admin_system";
$admin_sys = mysql_query($query_admin_sys, $edu_system) or die(mysql_error());
$row_admin_sys = mysql_fetch_assoc($admin_sys);
$totalRows_admin_sys = mysql_num_rows($admin_sys);


mysql_select_db($database_edu_system, $edu_system);
$query_student_list = "SELECT v_student.student_id, school.school_id, v_student.PREFIX_NAME_ID, v_student.STD_FNAME, v_student.STD_LNAME, v_student.PROGRAM_NAME_TH, v_student.STDGROUPLEAN,school.school_name,v_student.select_date_4,v_student.select_date_5, v_student.select_date_".$row_admin_sys['training'].",v_student.STD_TAMBOL,v_student.STD_AMPHUR,v_student.STD_PROVINCE FROM v_student Left Join school ON v_student.school_id_".$row_admin_sys['training']." = school.school_id 
where school.school_id ='".$_GET['school_id']."' and concat(year_".$row_admin_sys['training'].",term_".$row_admin_sys['training'].")=".$row_admin_sys['now_year'].$row_admin_sys['now_term']." ORDER BY v_student.student_id ASC";
$student_list = mysql_query($query_student_list, $edu_system) or die(mysql_error());
$row_student_list = mysql_fetch_assoc($student_list);
$totalRows_student_list = mysql_num_rows($student_list);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>แสดงโรงเรียนที่เลือกแล้ว</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="Place your description here" />
<meta name="keywords" content="put, your, keyword, here" />
<meta name="author" content="Templates.com - website templates provider" />
<link href="../ict/style.css" rel="stylesheet" type="text/css" />
<link href="../ict/layout.css" rel="stylesheet" type="text/css" /><style type="text/css"></style>
<script type="text/javascript" src="../edu_form/functions.js"></script>
<link rel="stylesheet" type="text/css" href="../edu_form/main.css" />
<link href="../webfonts/TH_Niramit_AS_Bold/stylesheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body,td,th {
	color: #333333;
}
</style>
</script><script type="text/javascript">  
function popup(url,name,windowWidth,windowHeight){       
    myleft=(screen.width)?(screen.width-windowWidth)/2:100;    
    mytop=(screen.height)?(screen.height-windowHeight)/2:100;      
    properties = "width="+windowWidth+",height="+windowHeight;   
    properties +=",scrollbars=yes, top="+mytop+",left="+myleft;      
    window.open(url,name,properties);   
}   
</script>
</head>
<body>
<?php include("header_nologin.php"); ?>
<div id="main">
<div id="content">

<h3><img src="../images/icon_32px/browser_32px.png" alt="" width="42" height="32" /> โรงเรียน<?php echo $row_student_list['school_name']; ?></h3>


        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td bgcolor="#FF0000"><table width="100%" border="0" cellpadding="1" cellspacing="1">
              <tr bgcolor="#FFFFFF">
                <td><table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">

                  <tr bgcolor="#99CC00">
                    <td width="36" height="28" style="font-weight: bold">&nbsp;ลำดับ&nbsp;</td>
                    <td height="28" colspan="2" align="center" nowrap="nowrap" style="font-weight: bold">นักศึกษา</td>
                  </tr>
                  <?php do { ?>
                    <tr bgcolor="<?php echo (((++$ii)%2)==0)?"FFE0C1":"FFFFFF"; ?>">
                      <td height="23" align="center" valign="top"><br />                        &nbsp;<?php echo ++$i+$startRow_school; ?>.</td>
                      <td width="144" height="23" align="center" nowrap="nowrap"><a href="javascript:popup('show_image_student.php?student_id=<?php echo $row_student_list['student_id']; ?>','',200,350)" ><br />
                      <img src="https://db.snru.ac.th/upload/uploads/<?php echo $row_student_list['student_id']; ?>.jpg" width="112" height="151" align="top" /></a><br />                        &nbsp;</td>
                      <td width="728" height="23" align="left" valign="top"><br />
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td height="28" valign="middle">&nbsp;<h2><?php echo $row_student_list['PREFIX_NAME_ID']; ?><?php echo $row_student_list['STD_FNAME']; ?>&nbsp;&nbsp;<?php echo $row_student_list['STD_LNAME']; ?></h2></td>
                          </tr>
                          <tr>
                            <td height="28" valign="middle"> รหัสนักศึกษา :&nbsp;<?php echo $row_student_list['student_id']; ?></td>
                          </tr>
                          <tr>
                            <td height="28" valign="middle">สาขาวิชา :&nbsp;<?php echo $row_student_list['PROGRAM_NAME_TH']; ?>&nbsp;&nbsp;&nbsp;หมู่&nbsp;<?php echo substr($row_student_list['student_id'],8,1); ?></td>
                          </tr>
                          <tr>
                            <td height="28" valign="middle">เลือกโรงเรียน :&nbsp;<span style=" color: #F00;"><?php echo $row_student_list['select_date_4']; ?></span></td>
                          </tr>
                        </table>
                        <br /></td>
                    </tr>
                    <?php } while ($row_student_list = mysql_fetch_assoc($student_list)); ?>
<tr>
                    <td colspan="3">&nbsp;</td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table>
  </div>
  <!-- footer -->
      
</div>
  </div>
</div>
<?php include("../footer.php"); ?>
</body>
</html>
<?php
mysql_free_result($student_list);
mysql_free_result($admin_sys);
?>