static array getAssocEq(
string
$strTable, string
$keyField, string
$valueField, [array
$arrWhere = array()]
)
|
|
return an associative array from the specified table
Parameters:
|
string |
$strTable: |
the table to query |
|
string |
$keyField: |
the field to be used as a key of the returned array |
|
string |
$valueField: |
the field to be used as a value of the return array |
|
array |
$arrWhere: |
an associative array with field => condition used to querying the $strTable |
API Tags:
static mixed getFieldValue(
string
$strTable, int
$intId, string
$fieldName
)
|
|
get the value of a field
the return value should be compared with the === operator
Parameters:
|
string |
$strTable: |
table to query |
|
int |
$intId: |
id |
|
string |
$fieldName: |
field name |
API Tags:
| Return: | false if the record could not be found, or the $fieldName value |
| Access: | public |
static mixed getModelByField(
$strTable
$strTable, $varValue
$varValue, [$strField
$strField = 'id']
)
|
|
create a ZedSeriesModel by the given table, and search for selected field (usually id)
<?php
/**
* a quick way to update the published field of a tl_page
*
* in the following example we retrieve the page ID 1 and set its published field to 1
*
*/
if ($mod !== false) {
$mod->published = 1;
$mod->save();
} else {
echo 'page id 1 not found';
}
Parameters:
|
$strTable |
$strTable: |
tablename |
|
$varValue |
$varValue: |
value to search for |
|
$strField |
$strField: |
field to query |
API Tags:
| Return: | object if the record was found else return false |
| Access: | public |