Home > Backend Development > PHP Tutorial > Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resourc

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resourc

WBOY
Release: 2016-06-23 14:27:33
Original
1609 people have browsed it




无标题文档




 



    include("conn.php");
    $SQL="SELECT * FROM `liuyanban` order by id desc";
    $query=mysql_query($SQL);
  
    
$total=mysql_num_rows($query);
$pagesize=3;
$end_page=ceil($total/$pagesize);
$page = $_GET['page']; //当前页
if($page {
$page =1;
}

if($page>$end_page)
{
$page=$end_page;
}
$start = ($page- 1)*$pagesize;
$sql = "select * from liuyanban limit $start, $pagesize ";

//mysql_query("set names 'GBK'");
$ros = mysql_query($sql,$connect);
?>


echo "留言表";
echo "
";
echo "当前第[$page]页,共[$end_page]页";
if($page==1)
{
 
?>
  首页
   }else
{
?>
  首页
  
  
   }
?>
  
  " >上一页
  " >下一页
  
   if($page==$end_page)
{
?>
  尾页
   }else
{
?>
  ">尾页
   }
?>


 

 
   



    
      
    

    
      
      
      
      
    
        while ($row=mysql_fetch_array($ros)){
   ?>
    
      
      
      
     
    
       }
   ?>
  
会员表
姓名
邮箱
留言内容
操作
=$row['name']?>
=$row['email']?>
=$row['liuyan']?>
">修改 ">删除


          增加会员表记录 






回复讨论(解决方案)

总是出现俩个错误:
数据库连接成功!
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in F:\phpnew\htdocs\hp\admintxl2.php on line 26

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\phpnew\htdocs\hp\admintxl2.php on line 103
 

$query=mysql_query($SQL)  or die(mysql_error());

请问你能告诉我改那个地方么

改完变成
Unknown column 'id' in 'order clause'了

谢谢啦。版主

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template