1. Get Affected rows or Number of Rows
$query = $this->db->get_where( 'user_albums', array( 'user_id'=>$uid, 'album_name'=>'Untitled') ); $this->db->affected_rows(); $query->num_rows();
2. Get Result
$res = $this->db->query("select user_id, comments, date from `comments` where xid = ".$photo_id);
$comment_data = $res->result(); if($res->num_rows() > 0) { foreach($rows as $singlerow) { //code to fetch data from $singlerow } }
or using result_array
$comment_data = $res->result_array();
3. Get Row Array from get_where
$query = $this->db->get_where('user_photos', array('album_id'=>$album_id ) ); $row = $query->row_array();
4. Get Data from Table
$this->db->select('photo_ids'); $this->db->from('user_suitcase_items'); $this->db->where($suitcasedata); $query = $this->db->get();
5. Get Data Using Where Condition.
$this->db->select('photo_ids'); $this->db->from('user_suitcase_items'); $this->db->where($suitcasedata);