每页内容不变


Content per page is not changing

我的PHP代码有问题,我想将数据库中的数据显示为每页10个数据(分页),但每页的内容没有改变,请帮助我编辑此代码并正确工作。大型

<?php
$host="localhost"; // Host name 
$username="root"; // Mysql username 
$password=""; // Mysql password 
$db_name="test"; // Database name 
$tbl_name="test_display"; // Table name 
// Connect to server and select databse.
//$uid= $_GET['uid'];
$connection = mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");
if (isset($_GET["uid"])) { $uid  = $_GET["uid"]; } else { $uid=1; }; 
$start_from = ($uid-1) * 10; 
// Retrieve data from database 
$sql="SELECT * FROM $tbl_name WHERE board_id ='5' ORDER BY date DESC  LIMIT $start_from, 10" ;
$rs_result = mysql_query ($sql,$connection); 
?>
<table width="980" border="0" cellspacing="0" cellpadding="0" class="contact-list">
 <colgroup>
<col width="20">
<col width="150">
<col width="250">
<col width="90">
<col width="90">
<col width="80">
<col width="80">
 </colgroup>
 <tr>
<th>번호</th>
<th>이름</th>
<th>내용</th>
<th>메일</th>
<th>연락처</th>
<th>연락처</th>
<th>글삭제</th>
</tr>
<?php
// Start looping rows in mysql database.
while ($row = mysql_fetch_array($rs_result)) { 
?>
<tr>
<td><?php echo $row['uid']; ?></td>
<td><?php echo $row['member_display']; ?></td>
<td><?php echo $row['content']; ?></td>
<td><?php echo $row['email']; ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['date']; ?></td>
<td><a href="" onclick="return confirm('삭제 하시겠습니까?');">글삭제</a></td>
</tr>
<?php
// close while loop 
}
?>
</table>

<?php 
$sql = "SELECT COUNT(*) FROM $tbl_name WHERE board_id ='5' "; 
$rs_result = mysql_query($sql,$connection); 
$row = mysql_fetch_row($rs_result); 
$total_records = $row[0]; 
$total_pages = ceil($total_records /10); 
for ($i=1; $i<=$total_pages; $i++) { 
            echo "<a href='http://daeheung.webgd.gethompy.com/?page_id=96=".$i."'>".$i."</a> "; 
}
?>

<?php
// close MySQL connection 
mysql_close();?>

乍一看,选择内容并没有错,而是使用分页链接你写得像

echo "<a href='http://daeheung.webgd.gethompy.com/?page_id=96=".$i."'>".$i."</a> "; 

试图找到类似的页码

if (isset($_GET["uid"])) { $uid  = $_GET["uid"]; } else { $uid=1; }; 

但是您的链接中没有参数uid。我想你想写一些类似的东西

echo "<a href='http://daeheung.webgd.gethompy.com/?page_id=96&uid=".$i."'>".$i."</a> "; 
相关文章:
  • 没有找到相关文章