FOUND_ROWS()

FOUND_ROWS()

FOUND_ROWS()
A select statement with limit clause is used to restrict the number of row returns. But if we want to know number of rows from the select query , we can use found_rows() function.To obtain this row count, include a SQL_CALC_FOUND_ROWS option in the SELECT statement, and then invoke FOUND_ROWS() afterward:

Syntax:
SELECT SQL_CALC_FOUND_ROWS * FROM [tbl_name] WHERE [condition] LIMIT [limit]

SELECT FOUND_ROWS();

Example:
SELECT SQL_CALC_FOUND_ROWS * from wordlist where keyword like ‘%key%’ limit 10;

SELECT FOUND_ROWS();

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.