html - php这样处理为什么无效

查看:108
本文介绍了html - php这样处理为什么无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

article.php文件代码

// 上一页
    public function lastpages(){
        // $this->dao->where("catid=$data[catid] and id<$id")->order('id desc')->find();
         $id = intval($_GET['id']);
        $sql = "SELECT id,title FROM " . get_table('article')." WHERE id< ".$id." ORDER BY id DESC LIMIT 1";
        $result = $this->query_all($sql);
        if($result){
            return $result;
        }else{
            return $result=false;
        }
    }
    // 下一页
    public function nextpages(){
         $id = intval($_GET['id']);
        $sql = "SELECT id,title FROM " . get_table('article')." WHERE id> ".$id." ORDER BY id ASC LIMIT 1";
        $result = $this->query_all($sql);
        if($result){
            return $result;
        }else{
            return $result=false;
        }
    }

main.php代码

// 上一页
$article_info['last_pagesdb'] = $this->model('article')->lastpages();
//下一页
$article_info['next_pagesdb'] =$this->model('article')->nextpages();

html调用代码

 <p><?php echo $article_info['next_pagesdb']; ?></p>

为什么不能输出上一篇下一篇文章呢?

解决方案

貌似你这种写法,你的 $article_info['next_pagesdb'] 应该是一个多维数组吧? 用var_dump 代替echo试试

这篇关于html - php这样处理为什么无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆