{"action":"created","issue":{"url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/17","labels_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/17/comments","events_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/17/events","html_url":"https://github.com/avenirer/CodeIgniter-MY_Model/issues/17","id":81918343,"number":17,"title":"paginate() returns nothing","user":{"login":"ngangchill","id":4242225,"avatar_url":"https://avatars.githubusercontent.com/u/4242225?v=3","gravatar_id":"","url":"https://api.github.com/users/ngangchill","html_url":"https://github.com/ngangchill","followers_url":"https://api.github.com/users/ngangchill/followers","following_url":"https://api.github.com/users/ngangchill/following{/other_user}","gists_url":"https://api.github.com/users/ngangchill/gists{/gist_id}","starred_url":"https://api.github.com/users/ngangchill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ngangchill/subscriptions","organizations_url":"https://api.github.com/users/ngangchill/orgs","repos_url":"https://api.github.com/users/ngangchill/repos","events_url":"https://api.github.com/users/ngangchill/events{/privacy}","received_events_url":"https://api.github.com/users/ngangchill/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-28T13:06:05Z","updated_at":"2015-05-29T09:09:31Z","closed_at":"2015-05-29T09:09:31Z","body":"there are 2 posts within the date range.   when i replace paginate() method with get_all()  it returns 2 posts.\r\n\r\n\r\nModel:\r\n\r\n     if ($month) {\r\n               $next_month = $month + 1;\r\n               $from = date(\"Y-m-d H:i:s\", mktime(0, 0, 0, $month, 0, $year));\r\n               $to = date(\"Y-m-d H:i:s\", mktime(23, 59, 59, $next_month, 0, $year));\r\n            } else {\r\n               $from = date(\"Y-m-d H:i:s\", mktime(0, 0, 0, 1, 0, $year));\r\n               $to = date(\"Y-m-d H:i:s\", mktime(0, 0, 0, 1, 0, ($year + 1)));\r\n            }\r\n              $total_rows = $this->where(array('dateCreated >' => $from,'dateCreated <' => $to, 'published' > 1))->count();\r\n        \r\n           \r\n\t     $data['posts'] = $this->where(array('dateCreated >' => $from,'dateCreated <' => $to, 'published' > 1))\r\n               ->fields('(SELECT COUNT(*) from blog_comments where blog_comments.postID = blog_posts.postID and deleted = 0 and active = 1) AS numComments, blog_posts.*', FALSE)\r\n                //->order_by('dateCreated', 'desc')\r\n                ->paginate(1,$total_rows);\r\n                \r\n        \r\n        $data['all_links'] = $this->all_pages; // will output links to all pages like this model: \"< 1 2 3 4 5 >\". It will put a link if the page number is not the \"current page\"\r\n        $data['older'] = $this->previous_page; // will output link to the previous page like this model: \"<\". It will only put a link if there is a \"previous page\"\r\n        $data['newer'] = $this->next_page; //\r\n                \r\n        return $data;\r\n\r\n\r\n\r\n\r\n\r\n## url:   http://localhost/blog/archieves/2015/05 \r\n\r\n\r\n## result:  \r\n         Dump => array(4) {\r\n         [\"posts\"] => bool(false)\r\n        [\"all_links\"] => string(270) \"<12>\"\r\n        [\"older\"] => string(69) \"<\"\r\n        [\"newer\"] => string(69) \">\"\r\n        }"},"comment":{"url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/comments/106752184","html_url":"https://github.com/avenirer/CodeIgniter-MY_Model/issues/17#issuecomment-106752184","issue_url":"https://api.github.com/repos/avenirer/CodeIgniter-MY_Model/issues/17","id":106752184,"user":{"login":"avenirer","id":3034772,"avatar_url":"https://avatars.githubusercontent.com/u/3034772?v=3","gravatar_id":"","url":"https://api.github.com/users/avenirer","html_url":"https://github.com/avenirer","followers_url":"https://api.github.com/users/avenirer/followers","following_url":"https://api.github.com/users/avenirer/following{/other_user}","gists_url":"https://api.github.com/users/avenirer/gists{/gist_id}","starred_url":"https://api.github.com/users/avenirer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avenirer/subscriptions","organizations_url":"https://api.github.com/users/avenirer/orgs","repos_url":"https://api.github.com/users/avenirer/repos","events_url":"https://api.github.com/users/avenirer/events{/privacy}","received_events_url":"https://api.github.com/users/avenirer/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T09:09:31Z","updated_at":"2015-05-29T09:09:31Z","body":"why don't you ask for a single field from comments_count and when outputing, instead of doing a foreach do a sizeof()? Or you can create a post_get callback."}}