Feature #20403 » 0011050v2-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 = ->exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,$limit);
|
||
$output = FALSE;
|
||
if (!$this->sql_error()) {
|
||
$output = array();
|
||
while($tempRow = $this->sql_fetch_assoc($res)) {
|
||
$output[$tempRow[$uid_field]] = $tempRow[$value_field];
|
||
}
|
||
$this->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. '*')
|