Pagination

I see. The problem there is that because your query only selects six rows (because of the LIMIT clause), the maximum value for $pages_query will be six, the maximum value for $results will be 1 because 6/6 is 1. You need to do a query first to count all the categories, use the rowcount from that to divide your per_page variable into for pagination.