上面打错 了

$sql="select * from table  LIMIT 0 , 30";
$all=mysql_num_rows($sql)

解决方案 »

  1.   

    结果 $all <= 30
      

  2.   

    那做做分页的时候不是要2个query?一个取得总数一个~~~~~~~~~~~~~~~上面那个了
      

  3.   

    是的.做分页的时候要用2个query用 $sql="select count(*) from table 先查出总记录数,在用  $sql="select * from table  LIMIT 0 , 30";分页
      

  4.   

    $sql="select count(*) from table";后
    怎么将值传给$all呢
      

  5.   

    $sql="select count(*) as total from table";
      

  6.   

    $sql="select count(*) from table";
    $result=mysql_query($Sql,$myconn);   //$myconn为连接
    $num=mysql_fetch_array($result);
    $num_rows=$num[0];
      

  7.   

    to:bonniewater(陪你去看海) 能不能说说 as total 是什么意思呢具体怎么样使用呢谢谢了
      

  8.   

    as total 是给count(*)取个total的别名,得总数$sql="select count(*) as total from table";
    $result=mysql_query($sql);
    $total=mysql_result($result,0,"total");
      

  9.   

    $sql="select count(*) as total from table";
    $result=mysql_query($sql);
    $total=mysql_result($result,0);不就行了?好象as total没有什么作用啊?是不是?