[Typo3] exec_SELECTquery Question

Thomas Hempel thomas at work.de
Thu Oct 13 16:24:16 CEST 2005


Hi Nick,

> Why does the exec_SELECTquery return less result rows than an orinary 
> SQL query?
> 
> I have this here in an extension
> 
> $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
>     'name, firstname, place, phone',
>     'user_phonelist_entries',
>     'name != "" AND firstname != "" AND deleted = 0 AND pid = "24"',
>     'name');
> 
> which returns only 171 result rows.
> 
> When I execute this query directly on the command line like so
> 
> SELECT name, firstname, place, phone
> FROM `user_phonelist_entries`
> WHERE name != ""
> AND firstname != ""
> AND deleted =0
> AND pid = "24"
> ORDER BY `name` ASC;
Because the fourth argument is "GROUP BY" and not "ORDER BY"

exec_SELECTquery(
	$select_fields,
	$from_table,
	$where_clause,
	$groupBy='',
	$orderBy='',
	$limit=''
)

You have to use something like

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
      'name, firstname, place, phone',
      'user_phonelist_entries',
      'name != "" AND firstname != "" AND deleted = 0 AND pid = "24"',
      '',
      'name');


Greets,
Thomas


--
typo3-unleashed.net



More information about the TYPO3-english mailing list