How to get total number of rows for particular query and also limiting the query results to 10 rows. For example. I've a table called sample. It has 400 rows. On running a query like where name = "%Sam%" it returns me 213 rows. Now I'l be taking only first 10 rows and displaying the result to user but I need the total rows returned. How should I need to do it in code igniter?
SELECT
SQL_CALC_FOUND_ROWS *
FROM
sample
WHERE
name like "%sam%"
like this? How to retrieve total number counts?