I am querying the database to return a simple array. IE: "SELECT * FROM contacts LIMIT 50"
But what i'm trying to figure out is, what if the user only has 10 contacts. I would like to show a response saying (10 of 10) contacts showing.
I know I could run 2 queries on the database, a. SELECT * FROM contacts (and then count the results) b. SELECT * FROM contacts (and then find the difference of A and B
But the problem lies when a user has 2,000 contacts which wouldn't be uncommon. and then querying the database every time the user selects the "contacts" page.
So is there a simpler way to do this? or am I on the right track?
Any light would be appreciated. Cheers.