Basta usar a função MySQL FOUND_ROWS() :http://dev.mysql. com/doc/refman/5.0/en/information-functions.html#function_found-rows