<?
$connect=@mysql_connect('localhost','root','');
$query="select * from content order by ID desc";
$result=mysql_db_query("dongyuan",$query,$connect);
$total=@mysql_num_rows($result); //结果的记录数
$r_row=@mysql_affected_rows($result);//获得最近操作的记录
$page_max_num=10;//每页显示的条目数
$page_num=ceil($total/$page_max_num);//总页面数if($total > 0)
{if(!$start_num)
 {$start_num=1;
}
}
$begin = ($start_num-1)* $page_max_num;
$end =$start_num*$page_max_num;
for($i=$begin;$i<$end;$i++)  //取出结果$result中的全部结果
{
@mysql_data_seek($result,$i); //将当前记录指针指向$result中的第$i条记录
$data=@mysql_fetch_array($result);
if(!empty($data))//是否有数据
{
?><table border ="1" width = "770" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC">
<tr bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<td width = "60" align="center"><strong><font color="#FFFFFF"> 序号</font></strong></td>
<td width= "100" align ="center"><strong><font color="#FFFFFF">姓名</font></strong></td>
<td width= "400" align ="center"><strong><font color="#FFFFFF">留言主题</font></strong></td>
<td width= "110" align ="center"><strong><font color="#FFFFFF">留言日期</font></strong></td>
<td width= "100" align ="center"><strong><font color="#FFFFFF">操作</font></strong></td>
</tr>
<tr >
<td width = "60" align="center"><? echo  $data[ID]; ?> </td>
<td width= "100" align ="center"><? echo $data[nickname]; ?></td>
<td width= "400" align ="center"> <?   echo "<a href = 'content.php ?title=".$data[title]."'>$data[title] </a>";?>  </td>
<td width= "110" align ="center"> <? echo  $data[date]; ?>  </td>
 <td width= "100" align ="center"><?   echo "<a href = 'edit.php ?id=".$data[ID]."&&do=content'><image src=image/modify.gif> </a>";?>
        <?   echo "<a href = 'delete.php ?id=".$data[ID]."&&do=content'><image src=image/del.gif> </a>";?>
    </td>
</tr>
</table>
<br><?
}
}
?>
<?php
//分页显示
 if($start_num<=1)
 {
  echo "begin";
 }
 else 
 {
 echo "<a href = 'show.php ?start_num=1&username=".$username."'>begin </a> ";
 
}
 echo "  ";
 
 if($start_num<=1)
 { echo "|pre";
}
else 
{
 echo "<a href = 'show.php?start_num=".($start_num-1)."&username=".$username."'>|pre </a> ";
}if($start_num>=$page_num)
{
    echo "|next";
}
 else
 {
  echo "<a href = 'show.php?start_num=".($start_num+1)."&username=".$username."'>|next </a> ";
 
 }
 if ($start_num>= $page_num)
 {
  echo " end";
 }
 else 
 {
  echo "<a href = 'show.php?start_num=".$page_num."&username=".$username."'>|end </a> ";
 }
  echo "[ ".$start_num."页/".$page_num."页 ]"  ;
 echo "一共 [".$total."]篇文章";
  echo " <a href = 'add.php?username=".$username."'><image src=image/new.gif></a> <br>";  mysql_close($connect);    
?>

解决方案 »

  1.   

    $q="select count(*) from zxdd where uid"; 
    $r=mysql_db_query($dbname,$q,$conn); // 这里返回的结果无效
    $num=mysql_fetch_row($r);  // 造成这里报错
      

  2.   

    应该怎么解决呢!谢谢您php守护神!
      

  3.   

    问题解决,可是有新 问题:分手为什么没有起到作用,打扰一下你的时间:请看:http://61.185.204.24/company/zxdd.php 用户密码是ahuasky,管理类型请选在线订单,谢谢!
      

  4.   

    感谢唠叨一再的支持!增加我学php信心!很感谢你!.........