![]() |
MYSQL Gurus.... i need adivce
I'm using mysql 4, and want to use the new FOUND_ROWS() to find out the number of rows the query would have returned if i did not use limit.
Lets say i have 100 members, and i want to display 10 of them per HTML page, so i'm doing something like: SELECT SQL_CALC_FOUND_ROWS * from my_table LIMIT 0,10; I then want to do a 2nd query, SELECT FOUND_ROWS(); to get the total number of results for my first query. (ie, i get 10 results, and now know how many total results i have, hence the number of pages of results). Would i be correct in thinking i should aquire a WRITE LOCK on the table before doing both SELECT queries? (my thinking being another process could perform another SELECT query on the table in between the first and second query, which would change the FOUND_ROWS() result...). ? How otherwise would you suggest i do this? Richard. |
You don't need to lock the tables. As long as you use the same connection for both queries you shouldn't have a problem.
|
All times are GMT -7. The time now is 12:29 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123