public function __construct()
{
// Call the CI_Model constructor
parent::__construct();
}
public function get_images($album_slug, $limit, $offset)
{
if ($offset > 0) {
$offset = ($offset - 1) * $limit;
}
//Get Images assigned to the Album
$this->db->select('*');
$this->db->from('albums');
$this->db->where('album_slug', $album_slug);
$this->db->join('images', 'albums.album_id = images.album_id');
$this->db->limit($limit,$offset);
$result['rows'] = $this->db->get();
return $result;
}
public function count_images($album_slug)
{
//Get Images assigned to the Album
$this->db->select('*');
$this->db->from('albums');
$this->db->where('album_slug', $album_slug);
$this->db->join('images', 'albums.album_id = images.album_id');
$result['num_rows'] = $this->db->count_all_results();
return $result;
}