SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: mysql count
-
Mar 19, 2001, 12:34 #1
- Join Date
- Jul 2000
- Posts
- 132
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
hey people.
what is the best way to count a the number of results from a mysql query?
Is it best to do one query, and then mysql_num_rows($query)
or is it best to do two queries, one a count query ( SELECT count(*) FROM whatever) and then the other query as normal?
Cheers.
-aj
-
Mar 19, 2001, 12:44 #2
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
AJ, it really depends on what your query is doing? If you were trying to get the total number of records in order to split the results amongst pages then you would want to use two queries. If all you are doing is querying the db for some results and you want to diplay and print the number of total results, one query would be just fine.
Please don't PM me with questions.
Use the forums, that is what they are here for.
Bookmarks