[TYPO3-english] t3lib sql_insert_id()

Marcel Remmy marcel.remmy at fh-kl.de
Wed Mar 18 17:11:42 CET 2009


First of all thanks to all of you for your fast help.

Your tips help a lot. Dmitry, you recommend the use of TCEmain. I'm
trying to stick as close as much to the cgl found in the core api.

So I suppose it's: "$data[ tablename ][ uid ][ fieldname ]" & "$tce =
t3lib_div::makeInstance('t3lib_TCEmain')" you're talking of.

So is it correct to use this function to manipulate system tables and
then to go with

* $GLOBALS['TYPO3_DB']->sql_insert_id();

to gain knowledge of the uid of the newly created item?

Greetings,

Marcel



Dmitry Dulepov wrote:
> Hi!
> 
> Marcel Remmy wrote:
>> In an extension I am developing, it's important to know which UID is
>> used for the new inserted element (be_groups / be_users dependencies
>> which are set automatically)
> 
> If you insert data into any TYPO3 system table, you should NOT access the database directly. You should use TCEmain for this. Otherwise any extension that may be watching for changes, will not be notified. Also reference index will be wrong if you directly manipulate the database. This will cause problems with clean up procedures.
> 
>> So I tried to use this function t3lib_sqlengine::sql_insert_id() that
> 
> Firsts, it is t3lib_db, not t3lib_sqlengine...
> 


More information about the TYPO3-english mailing list