mysql - Fatal error: Call to a member function result() on a non-object in code igniter model working fine in localhost -
this model code:
function get_ads($page=0, $type, $limit=1, $order=' order rand()') { if ($page === 0) { $page = $this->get_adpage(); $qry = "select * tbl_ads "; $qry .= " status=1 , pages '%".$page. "%'"; $qry .= " , type = ".intval($type); $qry .= $order; $qry .= intval($limit) > 1 ? " limit 0,".$limit : " limit 0,1"; $results = $this->db->query($qry)->result(); return $results;} } }
query
select * tbl_ads status=1 , pages '%1%' , type = 1 order rand() limit 0,1`
controller code
function get_ads(){ $this->main_model->get_ads(14,2,1); }
its working fine local when uploading server showing fatal error times times working fine.
thanks help
here solution $this->db->query($qry)->result() in instead of result() result_array() multiple rows or row_array() single row of result did trick
Comments
Post a Comment