Wednesday, 17 June 2020

count all with where condition in codeiginter sql

Model :
public function getRowcountCardGallery($id){
       
        return $this->db->where('card_id',(int)$id)->from("card_gallery")->count_all_results();
    }

Controller :
$data['rowcount']=$this->Myaccount_model->getRowcountCardGallery($id);

View : 
<?php if(isset($rowcount) && $rowcount!=''){
   
    echo $rowcount;

}


?>

No comments: