[TYPO3] problem with sql query

Daniel Pötzinger operation-lan at gmx.de
Sun Feb 12 13:53:22 CET 2006


stem wrote:
> hello,
> 
> i'm sure it is a stupid thing, however it drives me crazy.
> 
> i have the following sql query in my t3-extension:
> $query = 'SELECT storage_pid FROM pages WHERE uid = '.$GLOBALS['TSFE']->id;
> $storagePid = mysql(TYPO3_db, $query);
> 
> therewith i would like to receive the storage pid of the page, where my 
> extension is used in order to save the form entries in the corresponding 
> sys_folder.
> 

Hello

1)
It would be better to use the DBAL (see t3lib/class.t3lib_db.php)
e.g.
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(...)
$row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)

2.) There is no need for this select, T3 FE did already select these values:
Array:
$GLOBALS['TSFE']->page


Greetings



More information about the TYPO3-english mailing list