001.
<html>
002.
<head>
003.
<title>Test</title>
004.
<link href=
"ssm1.css"
rel=
"stylesheet"
type=
"text/css"
>
005.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
><style type=
"text/css"
>
006.
<!--
007.
body {
008.
background-image: url(image/bg.jpg);
009.
background-repeat: repeat-x;
010.
}
011.
-->
012.
</style></head>
013.
<body>
014.
<table width=
"625"
border=
"0"
align=
"center"
bordercolor=
"#0000FF"
bgcolor=
"#FFFF00"
>
015.
<tr>
016.
<td bordercolor=
"#FFFF00"
bgcolor=
"#FFFF00"
class
=
"ssm3"
><div align=
"right"
><strong>ระบบฐานข้อมูลศิษย์เก่า </strong></div></td>
017.
</tr>
018.
</table>
019.
<table width=
"625"
border=
"0"
align=
"center"
bordercolor=
"#0000FF"
>
020.
<tr>
021.
<td><div align=
"left"
><img src=
"image/banner1.png"
alt=
""
width=
"573"
height=
"87"
></div></td>
022.
</tr>
023.
<tr>
024.
<td> </td>
025.
</tr>
026.
<tr>
027.
<td><form name=
"frmSearch"
method=
"post"
action=
"<?=$_SERVER['SCRIPT_NAME'];?>"
>
028.
<table width=
"599"
border=
"0"
align=
"center"
>
029.
<tr>
030.
<th bordercolor=
"#339900"
bgcolor=
"#339900"
class
=
"ssm7"
><div align=
"left"
>:: ค้นหาข้อมูล </div></th>
031.
</tr>
032.
<tr>
033.
<th
class
=
"ssm1"
>รุ่นที่
034.
<select name=
"ddlSelect"
id=
"ddlSelect"
>
035.
<option value=
"19"
<?
if
(
$_POST
[
"ddlSelect"
]==
"19"
){
echo
"selected"
;}?>>19</option>
036.
<option value=
"27"
<?
if
(
$_POST
[
"ddlSelect"
]==
"27"
){
echo
"selected"
;}?>>27</option>
037.
<option value=
"35"
<?
if
(
$_POST
[
"ddlSelect"
]==
"35"
){
echo
"selected"
;}?>>35</option>
038.
</select>
039.
<input type=
"submit"
name=
"Search"
id=
"Search"
value=
"Search"
></th>
040.
</tr>
041.
</table>
042.
</form>
043.
<?PHP
044.
{
045.
include
(
"connect.php"
);
046.
047.
$strSQL
=
"SELECT * FROM member WHERE 1"
;
048.
if
(
$_POST
[
"ddlSelect"
] !=
""
)
049.
{
050.
$strSQL
.=
" AND (ddlSelect = '"
.
$_POST
[
"ddlSelect"
].
"') "
;
051.
}
052.
$objQuery
= mysql_query(
$strSQL
)
or
die
(
"Error Query ["
.
$strSQL
.
"]"
);
053.
$Num_Rows
= mysql_num_rows(
$objQuery
);
054.
$Per_Page
= 25;
055.
056.
$Page
=
$_GET
[
"Page"
];
057.
if
(!
$_GET
[
"Page"
])
058.
{
059.
$Page
=1;
060.
}
061.
062.
$Prev_Page
=
$Page
-1;
063.
$Next_Page
=
$Page
+1;
064.
065.
$Page_Start
= ((
$Per_Page
*
$Page
)-
$Per_Page
);
066.
if
(
$Num_Rows
<=
$Per_Page
)
067.
{
068.
$Num_Pages
=1;
069.
}
070.
else
if
((
$Num_Rows
%
$Per_Page
)==0)
071.
{
072.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
) ;
073.
}
074.
else
075.
{
076.
$Num_Pages
=(
$Num_Rows
/
$Per_Page
)+1;
077.
$Num_Pages
= (int)
$Num_Pages
;
078.
}
079.
080.
081.
$strSQL
.=
" order by Name ASC LIMIT $Page_Start , $Per_Page"
;
082.
$objQuery
= mysql_query(
$strSQL
);
083.
084.
?>
085.
<table width=
"600"
border=
"0"
align=
"center"
>
086.
<tr>
087.
<th colspan=
"3"
bordercolor=
"#CC6600"
bgcolor=
"#CC6600"
class
=
"ssm7"
><div align=
"left"
>:: ผลการค้นหา </div></th>
088.
</tr>
089.
<tr>
090.
<th width=
"97"
bordercolor=
"#CCCCCC"
bgcolor=
"#CCCCCC"
class
=
"ssm3"
> <div align=
"center"
><strong>ลำดับที่ </strong></div></th>
091.
<th width=
"399"
bordercolor=
"#CCCCCC"
bgcolor=
"#CCCCCC"
class
=
"ssm3"
> <div align=
"center"
><strong>ชื่อ - นามสกุล </strong></div></th>
092.
<th width=
"90"
bordercolor=
"#CCCCCC"
bgcolor=
"#CCCCCC"
class
=
"ssm3"
> <div align=
"center"
><strong>รุ่นที่ </strong></div></th>
093.
</tr>
094.
<?
095.
if
(
$_POST
[
'Search'
])
096.
while
(
$objResult
= mysql_fetch_array(
$objQuery
))
097.
{
098.
?>
099.
<tr>
100.
<td
class
=
"ssm2"
><div align=
"center"
>
101.
<?=
$objResult
[
"UserID"
];?>
102.
</div></td>
103.
<td
class
=
"ssm2"
><?=
$objResult
[
"Name"
];?></td>
104.
<td
class
=
"ssm2"
><div align=
"center"
>
105.
<?=
$objResult
[
"Ssmno"
];?>
106.
</div></td>
107.
</tr>
108.
<?
109.
}
110.
?>
111.
</table>
112.
<div align=
"center"
><br>
113.
<span
class
=
"ssm5"
>รวมทั้งหมด
114.
<?=
$Num_Rows
;?>
115.
ข้อมูล :
116.
<?=
$Num_Pages
;?>
117.
หน้า :
118.
<?
119.
if
(
$Prev_Page
)
120.
{
121.
echo
" <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_GET[txtKeyword]'><< Back</a> "
;
122.
}
123.
124.
for
(
$i
=1;
$i
<=
$Num_Pages
;
$i
++){
125.
if
(
$i
!=
$Page
)
126.
{
127.
echo
"[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_GET[txtKeyword]'>$i</a> ]"
;
128.
}
129.
else
130.
{
131.
echo
"<b> $i </b>"
;
132.
}
133.
}
134.
if
(
$Page
!=
$Num_Pages
)
135.
{
136.
echo
" <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_GET[txtKeyword]'>Next>></a> "
;
137.
}
138.
}
139.
mysql_close;
140.
?>
141.
</span></div> </td>
142.
</tr>
143.
<tr>
144.
<td> </td>
145.
</tr>
146.
<tr>
147.
<td><table width=
"174"
border=
"0"
align=
"center"
>
148.
<tr>
149.
<td width=
"168"
class
=
"ssm1"
><div align=
"center"
><a href=
"user_page.php"
><img src=
"image/gohome.png"
alt=
""
width=
"32"
height=
"32"
border=
"0"
></a></div></td>
150.
</tr>
151.
<tr>
152.
<td
class
=
"ssm1"
><div align=
"center"
>:: กลับหน้าหลัก :: </div></td>
153.
</tr>
154.
</table></td>
155.
</tr>
156.
<tr>
157.
<td> </td>
158.
</tr>
159.
</table>
160.
<p align=
"center"
> </p>
161.
</body>
162.
</html>