If you're using MySQL 4+ you could use the SQL_CALC_FOUND_ROWS flag in the
select statement.

It causes the query to count the number of rows it *would have* returned if
there had been no limit clause.

So after executing the query, you would then run another query to retrieve
the number if found rows.

Chris

-----Original Message-----
From: Chris W. Parker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 05, 2004 9:33 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] paging methodology


John W. Holmes <mailto:[EMAIL PROTECTED]>
    on Wednesday, May 05, 2004 7:32 AM said:

> Personal preference here, I guess, but I don't care for searches that
> don't tell you how many records were matched (or how many pages
> you'll have). I think the additional query is well worth it. The
> number of results tells me how successful my search was and whether I
> need to expand or shrink my search criteria.

i agree.

and as an update to this thread: i'm pretty much done with the whole
paging thing. having written my code in a much OO manner than the
previous incantation it was much easier to implement. in fact i only had
to add a few lines to the actual page code. most of it went into the
object itself. and you can sort on all the columns too.

i still need to add some other things like text searching (right now it
just returns all records) and the ability to adjust the number of
records per page. but other than that i think i'm all set.



chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to