[請益] 請教分頁及搜尋的功能...
小弟練習寫的簡單php程式碼如下...(單純列出所有SQL查詢外加排一下版)
<?php
include("./config_department.php");
if($_SESSION['UserID']!="admin"){
echo "<body bgcolor='#FFFFCC'>權限不足!!</body>";
exit;
}
?>
<table width=99% cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<table width=100% cellspacing=2 border=0 cellpadding=1>
<tr width=100%>
<td width=6% height=16 bgcolor="#c8c8c8">
<font size="1">編號</font>
</td>
<td width=6% height=16 bgcolor="#c8c8c8">
<font size="1">所屬單位</font>
</td>
<td width=6% height=16 bgcolor="#c8c8c8">
<font size="1">地點1</font>
</td>
<td width=8% height=16 bgcolor="#c8c8c8">
<font size="1">地點2</font>
</td>
</tr>
<?php
$sql = "SELECT * FROM table";
$r = mysql_query($sql);
while ($row = mysql_fetch_object($r)) {
$subject = urlencode($row->subject);
echo"
<tr width=100%>
<td width=6% height=16 style='font-size:10pt' bgcolor=#ffffff>
$row->appli_no
</td>
<td width=6% height=16 style='font-size:10pt' bgcolor=#ffffff>
$row->_dep
</td>
<td width=6% height=16 style='font-size:10pt' bgcolor=#ffffff>
$row->location1
</td>
<td width=8% height=16 style='font-size:10pt' bgcolor=#ffffff>
$row->location2
</td>
</tr>
";
}
?>
</table>
</td>
</tr>
</table>
想請教版上先進,如果要增加分頁及查詢的功能,可以怎麼做呢?
還請高手指點小弟...感謝。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.140.7.136
※ 編輯: redhat1980 來自: 220.140.7.136 (03/01 03:32)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章