Feature #20403 » 0011050-exec_SELECTgetField.patch
t3lib/class.t3lib_db.php (Arbeitskopie) | ||
---|---|---|
}
|
||
/**
|
||
* Creates and executes a SELECT SQL-statement AND traverse result set and returns array with array[uid_field]=select_field
|
||
*
|
||
* @param string result array will carry this field names value as index
|
||
* @param string result array will carry this field names value as value
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @param string See exec_SELECTquery()
|
||
* @return array Array of values: array[uid_field]=select_field.
|
||
*/
|
||
function exec_SELECTgetField($uid_field,$value_field,$from_table,$where_clause,$groupBy='',$orderBy='',$limit='') {
|
||
$select_fields = $uid_field . (strcmp($uid_field,$value_field) ? ',' . $value_field : '');
|
||
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit);
|
||
$output = FALSE;
|
||
if (!$GLOBALS['TYPO3_DB']->sql_error()) {
|
||
$output = array();
|
||
while($tempRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
|
||
$output[$tempRow[$uid_field]] = $tempRow[$value_field];
|
||
}
|
||
$GLOBALS['TYPO3_DB']->sql_free_result($res);
|
||
}
|
||
return $output;
|
||
}
|
||
/**
|
||
* Counts the number of rows in a table.
|
||
*
|
||
* @param string $field: Name of the field to use in the COUNT() expression (e.g. '*')
|