Index: t3lib/class.t3lib_db.php =================================================================== --- t3lib/class.t3lib_db.php (revision 9218) +++ t3lib/class.t3lib_db.php (revision ) @@ -365,6 +365,35 @@ } /** + * Creates and executes a SELECT SQL-statement AND gets a result set and returns an array with a single record in. + * LIMIT is automatically set to 1 and can not be overridden + * + * @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() + * @param boolean If set, the result will be fetched with sql_fetch_assoc, else sql_fetch_row will be used. + * @return array Single row. + */ + function exec_SELECTgetSingleRow($select_fields,$from_table,$where_clause,$groupBy='',$orderBy='',$numIndex=FALSE) { + $res = $this->exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy,$orderBy,'1'); + if ($this->debugOutput) $this->debug('exec_SELECTquery'); + + if (!$this->sql_error()) { + $output = array(); + + if ($numIndex===TRUE) { + $output = $this->sql_fetch_row($res); + } else { + $output = $this->sql_fetch_assoc($res); + } + $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. '*')