I have this question:
I have a simple search to a db, something like:
"select description from games where year = '1990'"
suppose I get 300 results, I would like to display this in pages of 30
results per page, so I would use "limit 0, 30" for the first page.
But this way, I don't know how many results would I have if I didn't use
"limit".
So how do I know if I have more than one page to display?, the only way I
can thing is to do the fist query without limit just to know the number of
results and the second one with "limit". But this seems like a lot of
overhead just to know the total results, is there a more efficient way to
do it?
Thank you.
Francisco
I have a simple search to a db, something like:
"select description from games where year = '1990'"
suppose I get 300 results, I would like to display this in pages of 30
results per page, so I would use "limit 0, 30" for the first page.
But this way, I don't know how many results would I have if I didn't use
"limit".
So how do I know if I have more than one page to display?, the only way I
can thing is to do the fist query without limit just to know the number of
results and the second one with "limit". But this seems like a lot of
overhead just to know the total results, is there a more efficient way to
do it?
Thank you.
Francisco
Comment