Database ( How to retrieve data from database) - Select
Select
As same as the filter function, with the select function too you can retrieve the data from the database. But Filter and Select functions are having different behavior. Filter function is used to filter data. Select function is used to retrieve exact matching data.
The select function contains following parameters.
1) $itemname - Database column (field) name(s) you need to filter.
2) $value - Column values that should match when filtering.
3) $exact_match - Whether this should match whole word or partial? If $exact_match is set to true, It will return only exact match results. If $exact_match is set to false, It will return both whole word matches and partial matches as result.
4) $and_or - You can set "AND" "OR" logic here.
5) $sortitem - The database column name which is used to sort the result.
6) $sort_order - You can set sort order here. Whether Ascending or Descending.
7) $max - Maximum number of records.
8) &$is_last - Whether the last item is loaded.
select($itemname,$value,$exeact_match,$and_or,$sortitem,$sort_order,$max,&$is_last)
The database will contain following data
select([“vegetable”,”country”,”amount”],[“”,””,””]),true,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“pp”,”a”,””],false,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“P”,””,””],false,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“”,””,”1”],false,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“”,””,”12”],false,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“”,””,””],true,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“Apple”,””,””],true,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“apple”,””,””],true,"AND",null,null,$max,$is_last)
Result screen is shown below.
select([“vegetable”,”country”,”amount”],[“Apple”,”America”,””],true,”AND”,null,null,$max,$is_last)
Result screen is shown below.
Select([“vegetable”,”country”,”amount”],[“Apple”,”America”,””],true,"AND",'vegetable',SORT_ASC,$max,$is_last)
Select([“vegetable”,”country”,”amount”],[“Apple”,”America”,”10”],true,"AND",'vegetable',SORT_ASC,$max,$is_last)
Result screen is shown below.
Select([“vegetable”,”country”,”amount”],[“Apple”,””,”10”],true,"OR",'vegetable',SORT_ASC,$max,$is_last)
Result screen is shown below.
Select([“vegetable”,”country”,”amount”],[“Apple”,””,””],true,"OR",'vegetable',SORT_ASC,$max,$is_last)
Result screen is shown below.
Select([“vegetable”,”country”,”amount”],[“pp”,””,””],false,"OR",'vegetable',SORT_ASC,$max,$is_last)
Result screen is shown below.