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-13 11:48:46
Original
1173 people have browsed it

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



无标题文档




 



    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']?>
">修改 ">删除


          增加会员表记录 






------解决方案--------------------
$query=mysql_query($SQL) or die(mysql_error());
Related labels:
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