Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

sql_limit_with_total_count()

Description

Utility function to obtain the total found rows while paginating the results.

IMPORTANT: the input query MUST have a deterministic order so it can help with performance and not have an undefined behaviour

configuration option (e.g $default_perpage, $default_perpage_list).

- total: int - count of total found records (before paging)
- data: array - paged result set

Parameters

ColumnTypeDefaultDescription
$query PreparedStatementQuery SQL query
$rows null|int Specifies the maximum number of rows to return. Usually set by a global
$offset null|int Specifies the offset of the first row to return. Use NULL to not offset.
$cachecount bool false Use previously cached count if available?
$countquery null|PreparedStatementQuery null Optional separate query to obtain count, usually without ORDER BY

Return

array Returns a:

This article was last updated 15th December 2024 09:35 Europe/London time based on the source file dated 27th November 2024 15:30 Europe/London time.