After checking the manual, we can find that the SQL _CALC_FOUND_ROWS keyword is used to count the total number of results that meet the filtering conditions (not limited by Limit, if you are interested, you can learn the MYSQL Keyword: SQL _CALC_FOUND_ROWS. After checking the manual, you can find that this keyword is used to calculate the results after the filtering conditions are met during query.
After checking the manual, we can find that the SQL _CALC_FOUND_ROWS keyword is used to count the total number of results that meet the filtering conditions (not limited by Limit, if you are interested, you can learn the MYSQL Keyword: SQL _CALC_FOUND_ROWS. After checking the manual, you can find that this keyword is used to calculate the results after the filtering conditions are met during query.
After reading the manual, I found that the SQL _CALC_FOUND_ROWS keyword is used to count the total number of results that meet the filtering conditions (not limited by Limit) during queries. If you are interested, you can learn the following.
Keywords of MYSQL:
SQL _CALC_FOUND_ROWS
After checking the manual, we found that this keyword is used to count the total number of results that meet the filtering conditions during the query (not limited by Limit)
For example:
The Code is as follows:
SELECT SQL _CALC_FOUND_ROWS tid FROM cdb_threads WHERE fid = 14 LIMIT 1, 10;
Suppose there are 1000 conditions, and 10 are returned here.
Use now
The Code is as follows:
SELECT found_rows () AS rowcount;
The returned rowcount is 1000;
This reduces the repeated queries of SELECT count (*) AS rowcount, which can save a considerable amount of time.
The following are the applications that should be applied in the game flavor:
The Code is as follows:
Function mail_list_sent ($ uid, $ start ){
// Note that there is no comma between SQL _CALC_FOUND_ROWS uid
$ Query = "SELECT SQL _CALC_FOUND_ROWS uid, real_name, current_city, msg_uid, sender_flag ,".
"Msg_title, msg_content FROM". TT_DBTABLEPRE. "mailbox as mb1,". TT_DBTABLEPRE.
"User as usr1 WHERE mb1.sender _ id = usr1.uid AND mb1.sender _ id = $ uid AND sender_flag> 0 LIMIT $ start,". TT_PAGESIZE;
$ Mails = $ this-> db-> fetch_all ($ query );
// Query the number of rows in the SELECT statement that meet the conditions, regardless of the LIMIT clause.
$ Max_count = $ this-> db-> fetch_first ("SELECT found_rows () AS rowcount ");
$ Tmp ['State _ Code'] = 200;
$ Tmp ['info'] = "OK ";
$ Tmp ['LIST'] = $ mails;
$ Data = json_encode ($ tmp );
Return $ data;
}