Your controller has this line:
PHP Code:
$config["total_rows"] = $this->Model_movie_genre->movies_by_genre($genre_type);
The model function:
PHP Code:
public function movies_by_genre($genre_type)
{
$query = $this->db->query("SELECT * FROM movies_info WHERE movie_genre=? ORDER BY movie_id DESC", array('movie_genre'=>$genre_type));
return $query->result_array();
}
This function always returns an array (an empty array if there are no results). Which is wrong, because $config['total_rows'] must be a numeric value (0 or greater) to make the pagination work.
Create a new function in the model:
PHP Code:
public function movie_count($genre_type)
{
return $this->db->where('movie_genre', $genre_type)->count_all_results('movies_info');
}
In the controller:
PHP Code:
$config["total_rows"] = $this->Model_movie_genre->movie_count($genre_type);