Brimbox Logo Brimbox Version 2.3.4 Released

return_rows>>

This method outputs a database record as formatted in the Set Column Names administration panel taking column security in consideration. It also returns the count of rows which can be used in pagination.

Class: bb_main, called as $main

File: bb_main.php (php)

Declaration:

function return_rows($row, $arr_columns, $params = array())

Usage:

$cnt_rows = $main->return_rows($row, $arr_columns, $params);

Returns: count of total rows selected by query (see sample query below)

Outputs: Standard Brimbox record based on column design for data, rows, and columns.

Parameter: $row (array, db resultset row)
Typically when using this function a whole database data_table row is passed to the function. This row must also contain the cnt field which is returned. See queries below for paginated and non-paginated examples.

Parameter: $arr_columns (array)
This contains the column array for the given row_type, where $arr_columns is retrieved from the json_table. These columns are set in the administration panel module called “Set Column Names”.

Parameter: $params (optional array)
The parameters array for passing custom parameters to the function.

Optional Parameters:

  • check, checks the column security level and outputs all records with secure less than $params['check']. default 0 returns all records, use $params['check'] = 1 to return only records where secure is 0. (integer, default 0)

With Pagination:
SELECT count(*) OVER () as cnt, *
FROM data_table WHERE row_type = 1 LIMIT 10 OFFSET 0

Without Pagination:
SELECT count(*) OVER () as cnt, *
FROM data_table WHERE row_type = 1

Updated: 2016-07-17