if($id_stu !=""and $name_stu !=""and $last_name_stu !="" and $class_level_stu !="" and $major_stu !="" and $sts_stu !="" ){
/*echo "loop1";
echo */ $sql = "select * From stu where
id_stu LIKE '%$id_stu%' and
name_stu LIKE '%$name_stu%' and
last_name_stu LIKE '%$last_name_stu%' and
class_level_stu = '$class_level_stu' and
major_stu = '$major_stu' and
sts_stu = '$sts_stu'";
if(($Page>$Num_Pages) || ($Page<0))
print "<center><b>จำนวน $Page มากกว่า $Num_Pages ยังไม่มีข้อความ<b></center>";
$sql = "select * From stu where
id_stu LIKE '%$id_stu%' and
name_stu LIKE '%$name_stu%' and
last_name_stu LIKE '%$last_name_stu%' and
class_level_stu = '$class_level_stu' and
major_stu = '$major_stu' and
sts_stu = '$sts_stu'
order by id DESC LIMIT $Page_start , $Per_Page_ac_all";
$result = mysql_query($sql);
}elseif ( $id_stu =="" and $name_stu =="" and $last_name_stu =="" and $class_level_stu =="" and $major_stu =="" and $sts_stu !=""){
/*echo "loop22";
echo */$sql = "select * From stu where
sts_stu = '$sts_stu' ";
$db=mysql_select_db($dbname);
$sql_class = "select * from province ORDER BY id ASC
";
$result_class = mysql_query($sql_class);
while ($row_class = mysql_fetch_array($result_class, MYSQL_ASSOC)) {
$id = $row_class[id];
$name = $row_class[name];
?>
<tr>
<td><?php echo $row[id_stu]; ?></td>
<td><?php echo $row[name_stu]." "." ".$row[last_name_stu]; ?></td>
<td><?php $class_level_stu= $row[class_level_stu];
$sql_level = "select * from province where id = $class_level_stu ORDER BY id ASC
";
$result_level = mysql_query($sql_level);
while ($row_level = mysql_fetch_array($result_level, MYSQL_ASSOC)) {
echo $row_level[name];
}
?></td>
<td><?php $major_stu = $row[major_stu];
$sql_major = "select * from amphur where id = $major_stu ORDER BY id ASC
";
$result_major = mysql_query($sql_major);
while ($row_major = mysql_fetch_array($result_major, MYSQL_ASSOC)) {