DATA Methods

select()

Select data from table. You can use this function no matter whether the table has been imported or not. With imported tables by default the data will be selected using the ORDER BY (backend-setting "sort") settings defined in backend.

array select( string table [, array fields = false [, string where = false [, string index = false [, bool access = false ]]]])

Return

List of selected fields and values.

Parameter
Description
tableThe table name.
fieldsFields to be selected. If left empty, all fields will be selected. The array can contain fields or you can asign an alias to each field. See example below.
whereSQL where statement without the SQL keyword WHERE. If left empty, all records will be selected.
indexThe index of your returning array. Usually the array is indexed by record-numbers. If you pass the name of a field, the array will be indexed by the values of this field. Make sure your index-field is unique, otherwise some data in your returning array will be overwritten.
accessIf TRUE the function will check user access settings for each record.

Get complete table data

$DATA->select("data_api_object")
RETURN: ARRAY [8]

Get data, index by primary key

$DATA->select("data_api_object", false, false, "ID_API_OBJECT")
RETURN: ARRAY [8]

Get selected fields of non-imported table

$DATA->select("data_test", array("test_time", "test_char"), "test_int = 5")
RETURN: ARRAY [3]

Assign alias to each selected field

$DATA->select("data_test", array("test_time" => "timetest", "test_char" => "chartest"))
RETURN: ARRAY [4]