致命错误:对代码点火器模型中非对象的成员函数result()进行调用,使其在localhost中可以正常工作

Venkat针套

这是我的模型代码:

function get_ads($page=0, $type, $limit=1, $order=' order by rand()') { 
    if ($page === 0) {
        $page = $this->get_adpage(); 
        $qry = "select * from tbl_ads ";
        $qry .= " where status=1 and pages like '%".$page. "%'";
        $qry .= " and type = ".intval($type);
        $qry .= $order;
        $qry .= intval($limit) > 1 ? " limit 0,".$limit : " limit 0,1";   
        $results = $this->db->query($qry)->result(); return $results;}
     }
}

像这样查询

SELECT * FROM tbl_ads WHERE STATUS=1 AND pages LIKE '%1%' AND TYPE = 1 ORDER BY RAND() LIMIT 0,1` 

控制器代码为

function get_ads(){
    $this->main_model->get_ads(14,2,1);
}

在上载到服务器时,它在本地正常工作,有时会显示致命错误,但有时却可以正常工作。

谢谢你的帮助

Venkat针套

这里的解决方案$ this-> db-> query($ qry)-> result()而不是多行的result()result_array()或单行结果的row_array()

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

Related 相关文章

热门标签

归档