Been following examples from here and many other sites but not getting the expected results
Snippet of my PHP code;
$query=\"SELECT * FROM book\";
$resul
Add a SQL_CALC_FOUND_ROWS to your select statement: http://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_found-rows
This forces MySQL to count the rows as if the limit statement is not present.
$query="SELECT SQL_CALC_FOUND_ROWS * FROM book LIMIT 0,4";
Your most recent query returned 4 rows ($query="SELECT * FROM book LIMIT 0,4";
).
That's why it returns 4 and not 14.
To quote the documentation:
In the absence of the SQL_CALC_FOUND_ROWS option in the most recent successful SELECT statement, FOUND_ROWS() returns the number of rows in the result set returned by that statement. If the statement includes a LIMIT clause, FOUND_ROWS() returns the number of rows up to the limit.