[TYPO3] MySQL question

Peter Russ peter.russ at 4many.net
Tue Sep 12 13:26:43 CEST 2006


Livius Agrippa schrieb:
> Hi,
> 
> How is it possible to select the feusers which belongs to one group?
> I want to use this in an extension and as you know the usergroup field
> in the table fe_users is a tinyblob.
> I am not so good with regular expressions.
> It will be nice if a Typo3 function is used. :)
> 
> Best regards,
> Livius
  Plain SQL:
select uid from fe_users where usergroup like '2' or usergroup like 
'2,%' or usergroup like '%,2,%' or usergroup like '%,2'

TYPO3:
$group=2;
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid',
'fe_users',
'usergroup like "'.$group.'" or usergroup like "'.$group.',%" or 
usergroup like "%,'.$group.',%" or usergroup like "%,'.$group.'"'
)
while($rec=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
{
//...your code goes here
}

Regs. Peter.

-- 
Fiat lux!
Docendo discimus.
_____________________________
4Many® Services
openBC: http://www.openbc.com/go/invuid/Peter_Russ



More information about the TYPO3-english mailing list