Home  >  Article  >  Backend Development  >  提示我<?php while ($myrow=mysql_fetch_array($result)){ 这里出错了,但我不知道这里有什么错了?求高手解答?

提示我<?php while ($myrow=mysql_fetch_array($result)){ 这里出错了,但我不知道这里有什么错了?求高手解答?

WBOY
WBOYOriginal
2016-06-23 14:26:55942browse

php+mysql




无标题文档




include("conn/conn.php"); //包含conn.php文件
if (isset($_GET['page'])){
$page=$_GET['page'];
}else{
$page=1;
}?>
   if($page){
    $page_size=4;          //每页显示4条记录
    $query="select * from tb_news";  //定义查询语句
$result=mysql_query($query); //执行查询操作
$message_count=mysql_num_rows($result); //获取查询总数
    $page_count=ceil($message_count/$page_size);  //获取总的页数
    $offset=($page-1)*$page_size;  
    $query="select * from tb_user where id order by id desc limit $offset, $page_size";
$result=mysql_query($query);
}
?>


  
    
    
    
     
   while ($myrow=mysql_fetch_array($result)){ //使用while循环输出查询结果
?>
  
       
    
    

     } //结束while循环
?>
新闻标题 新闻内容 编辑

if($page!=1){
echo "首页";
echo "上一页";
}
if($page echo " 下一页";
echo " 尾页";
}
?>



回复讨论(解决方案)

求高手解答。。。为什么会出现这个

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\wamp\www\wuliupeisong\admin\edit_news.php on line 41

$query="select * from tb_user where  id order by id desc limit $offset, $page_size"; //标红处有问题吧?

噢噢,非常谢谢你

$query="select * from tb_user where  id order by id desc limit $offset, $page_size"; //标红处有问题吧?

非常感谢你,问题解决了

Statement:
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