Thanks, but your script is actually limiting in one subtle way...
I am dealing with what will rapidly become a large database = 100,000 rows or more.
This script reads ALL of the rows from a query into memory, then counts them.
(see line in your script: $numresults = mysql_query("SELECT * FROM table WHERE condition ORDER BY whatever", $db)😉
This could quickly kill a busy web-server!
I'm going ahead using the SQL limit / offset functions - only the information to work with for the current page is kept in memory. (Important with lots of transactions)
Also, instead of counting the rows from what's read, you might try something like
"select count(*) as numrows from table where <condition>".
This would return only the number of rows that apply. Again, really nice on RAM, and also gives fast execution.
I just could not remember or find the name of limit/offset!
-Ben
=)