> I was thinking along the lines that there needed to be a query that
> some results that may also be displayed or used within the script. For
> instance, I use a paging script that queries for certain conditions and
> returns 40 records per page. I also display a line that says, "There are x
> records based on the criteria that you have selected.". x comes from
> mysql_num_rows. Now, if all I had to do was get the number of records I
> would use sql COUNT and test for the condition by seeing what number was
> returned by the COUNT.

I still think it's more effecient to use two queries in your case. One with
a COUNT(*) to get total records, and one with a LIMIT to just get the 40 you
want. With a smaller table, it may not matter, but with large tables, you
could be using up a lot of resources by selecting everything, but then only
using 40 rows of it.

You already have the connection open, so two efficient queries would still
be quick.

---John Holmes...

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

Reply via email to