[TYPO3-dev] Update database when saving plugin flexform configuration in BE?

Dmitry Dulepov dmitry.dulepov at gmail.com
Wed Sep 9 18:49:43 CEST 2009


Hi!

Gerhard Mehsel wrote:
> Hmm seems to be ok:
> 
> $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pi_flexform',
> 'tt_content','uid='.$id, null, null, 1);

Not ok because uses null. Should be empty string.

> while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
>    $flexcontent = $row;
> }

Memory leak here: you did not free the recordset. Also there is no need for the loop: you have only one row, which you could access as with a single call to sql_fetch_assoc().

If I were you I would simply do this:

list($row) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pi_flexform', 'tt_content', 'uid=' . $id, '', '', 1);

-- 
Dmitry Dulepov
Facebook: http://www.facebook.com/dmitryd
Twitter: http://twitter.com/dmitryd
Skype: liels_bugs




More information about the TYPO3-dev mailing list