当前位置:Gxlcms >
PHP教程 >
Warning:mysql_num_rows():suppliedargumentisnotavalidMySQLresultresourc,该如何解决
Warning:mysql_num_rows():suppliedargumentisnotavalidMySQLresultresourc,该如何解决
时间:2021-07-01 10:21:17
帮助过:3人阅读
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<=0)
{
$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());