$key = $HTTP_POST_VARS["inpnum"];
$page=
$HTTP_POST_VARS["page"];
//DB$B$X@\B33+;O(J $B%5!<%P!(J--localhost($B$^$?$O(JIP$B%"%I%l%9!K(J $B%f!<%6!(J--root $B%Q%9%o!<%I(J--root
$dbHandle
= mysql_connect("localhost","user","password");
//DB$B$N@\B3$K<:GT$7$?>l9g$O%(%i!if ($dbHandle == False) {
print
("can not connect db\n");
exit;
}
/$BJG?t$,%;%C%H$5$l$F$$$J$$>l9g$OJG?t$K(J1$B$r%;%C%H(J
if ($page < 1) {
$page =
1;
}
//$B3+;O9T$r;;=P(J
$startline = ($page - 1) * $maxline;
//$B=*N;9T$r;;=P(J
$endline = $page * $maxline -1;
//db$BL>(J test
$db = "test";
//SQL$BJ8(J tab1$BI=$+$i(Jfield1$B$+$i(Jfield3$BNs$NCf$K(J$key$B$r4^$`8l6g$,$"$l$P>:=g(J(order by )$B$GH4$-=P$9(J
$sql
= "select * from tab1 where (field1 like '%$key%' or field2 like '%$key%' or
field3 like '%$key%') order by id";
//SQL$BJ8$r $rs= mysql_db_query($db,$sql);
//$BNs?t$r$num = mysql_num_fields($rs);
//$B//ceil($B?tCM(J)$B$O>.?tE@0J2<$r@Z$j>e$2$k4X?t(J
$maxpage =
ceil(mysql_num_rows($rs) / $maxline);
//HTML$BJ8$r=PNO!!%F!<%V%k$N3+;O$r;XDj(J
print("<table border=1>");
//$B8=:_$NJG(J/$B:G=*JG$rI=<((J
print("<caption valign='top' align='right'>Page
".$page."/".$maxpage."</caption>");
//mysql_num_fields$B!!4X?t$r;HMQ$7Ns?t$r$fields = mysql_num_fields($rs);
//mysql_num_rows$B!!4X?t$r;HMQ$79T?t$r$rows = mysql_num_rows($rs);
//$BF~NO$5$l$?(Jnumber$B$N9T$,$"$C$?>l9g$O%G!<%?$r=PNO$9$k(J
if ($rows > 0) {
//HTML$BJ8$r=PNO!!%F!<%V%k$N3+;O$r;XDj(J
print("<TABLE border=1>");
//test$BI=$NNs?t$HF1$82s?t$r7+$jJV$9(J
for ($i=0;$i<$fields;$i++){
//HTML$BJ8$r=PNO!!NsL>$r(J
<td>$B$G0O$s$GB@;z$G=PNO(J
print("<td><b>".mysql_field_name($rs,$i)."</b></td>");
}
//mysql_data_seek$B$K$h$j(Jtest$BI=Fb$N;XDj$7$?9T$K0\F0$9$k(J
mysql_data_seek($rs,$startline);
//$i$B$K(J$startline$B$rBeF~(J
$i=$startline;
//$B:G=*9T$G$J$/!!$+$D!!(J$i<=$endline$B$N>r7o$N4V(J
//test$BI=$+$i9T$rwhile($row=mysql_fetch_array($rs)
and $i<=$endline){
//HTML$BJ8$r=PNO!!I=$N9T$N3+;O(J<tr>
$B$r=PNO(J
print("<tr>");
//test$BI=$NNs?t$HF1$82s?t$r7+$jJV$9(J
for($j=0;$j<$fields;$j++){
//HTML$BJ8$r=PNO!!Ns$NFbMF$r(J
<td>$B$G0O$s$G=PNO(J
print("<td>".$row[$j]."</td>");
}
//HTML$BJ8$r=PNO!!I=$N2~9T(J</tr>
$B$r=PNO(J
print("</tr>");
//$i$B$K(J1$B$r2C;;(J
$i = $i + 1;
}
}
//$BF~NO$5$l$?(Jnumber$B$N9T$,B8:_$7$J$+$C$?>l9g$O%(%i!<%a%C%;!<%8$r=PNO$9$k(J
else
{
print(" [" .$key . "]
$B$N%G!<%?$OEPO?$5$l$F$$$^$;$s(J<br>");
}
//HTML$BJ8$r=PNO!!%F!<%V%k$N=*N;$r;XDj(J
print("</TABLE>");
//HTML$BJ8$r=PNO!!%F!<%V%k$N3+;O$r;XDj(J
print("<table><tr>");
//HTML$BJ8$r=PNO!!(Jcaption
$B$r=PNO(J
print("<caption align='bottom'>");
//$B8=:_I=<($7$F$$$kJG$,#1%Z!<%8$h$j8e$NJG$N>l9g$OA0$NJG$N%j%s%/$r:n@.(J
if ($page > 1)
{
$i = $page -
1;
//HTML$BJ8$r=PNO!!(J.$page$B$K;XDj$5$l$?JG?t$r%;%C%H$7$F(JGET$B$GEO$9%j%s%/$r:n@.(J
print("<td>");
print("<FORM action='$PHP_SELF'
method=post>");
print("<INPUT type=hidden name=inpnum value=
".$key.">");
print("<INPUT type=hidden name=page value=
".$i.">");
print("<INPUT type=submit
value=$BA09`(J>");
print("</FORM>");
print("</td>");
}
//$B8=:_I=<($7$F$$$kJG$,#1%Z!<%8$G$O$J$/:G=*JG$G$O$J$$>l9g$OA0JG$H//$B6h@Z$k!V!&!W$r=PNO(J
if ($page <> 1
and $page <> $maxpage)
{
print("<td>");
print("$B!&(J");
print("</td>");
}
//$B8=:_I=<($7$F$$$kJG$,:G=*JG$h$jA0$NJG$N>l9g$OA0$NJG$N%j%s%/$r:n@.(J
if ($page < $maxpage)
{
$i = $page +
1;
//HTML$BJ8$r=PNO!!(J.$page$B$K;XDj$5$l$?JG?t$r%;%C%H$7$F(JGET$B$GEO$9%j%s%/$r:n@.(J
print("<td>");
print("<FORM action='$PHP_SELF'
method=post>");
print("<INPUT type=hidden name=inpnum value=
".$key.">");
print("<INPUT type=hidden name=page value=
".$i.">");
print("<INPUT type=submit
value=$B
print("</FORM>");
print("</td>");
}
//HTML$BJ8$r=PNO!!%F!<%V%k$N=*N;$r;XDj(J
print("</tr></TABLE>");
///HTML$BJ8$r=PNO!!2~9T(J
print("<br>");
print("<table><tr>");
//$B=PNO2DG=$JJG?t?tJ,7+$jJV$9(J
for
($i=1;$i<=$maxpage;$i++) {
//$B8=:_$NJG$N;~$O(J [ ]$B$G0O$`(J
if
($i==$page){
print("<td>");
print("[".$i."]");
print("</td>");
} else
{
//HTML$BJ8$r=PNO!!(J.$page$B$K;XDj$5$l$?JG?t$r(JGET$B$GEO$9%j%s%/$r:n@.(J
print("<td>");
print("<FORM action='$PHP_SELF'
method=post>");
print("<INPUT type=hidden name=inpnum value=
".$key.">");
print("<INPUT type=hidden name=page value=
".$i.">");
print("<INPUT type=submit
value=".$i.">");
print("</FORM>");
print("</td>");
}
//$B:G=*JG0J30$G$OJG4V$r6h@Z$k!V!&!W$r=PNO(J
if ($i <>
$maxpage)
{
print("<td>");
print("$B!&(J");
print("</td>");
}
if($i%10==0){
print("</tr><tr>");
}
}
print("</tr></table>");
//HTML$BJ8$r=PNO!!(J/caption
$B$r=PNO(J
print("</caption>");
print("</TABLE>");
//$B7k2L%l%3!<%I$r%a%b%j$+$i3+J|(J
mysql_free_result($rs);
//DB$B$X$N@\B3$r@ZCG(J
mysql_close($dbHandle);
//HTML$BJ8$r=PNO!!(Jjavascript$B$r;HMQ$7$FD>A0$N%Z!<%8$KLa$k%j%s%/(J
print ("<br><a
href='kennsaku.php'>$BLa$k(J</a><br>");
//HTML$BJ8$r=PNO!!(JBODY$B$N=*N;(J
print("</BODY>\n");
//HTML$BJ8$r=PNO!!(JHTML$B$N=*N;(J
print("</HTML>\n");
?>
$B!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v!v(J