[TYPO3] After using the API to copy a page, sql_insert_id() is 0. How do I get insert id?

Xavier Perseguers typo3 at perseguers.ch
Mon Aug 11 21:52:40 CEST 2008


Hi Peter,

> Try:
> 
> $id = $tce->substNEWwithIDs['NEW'];

Are you certain it works? Because I quickly read the code when this 
question was posted and did not find a way to retrieve this information 
as the page copy can recursively copy pages and as such there is no 
unique uid that should be returned. The code you give looks strangely 
close to what is needed to retrieve the uid of a newly created page, 
using the tce too but when creating a new page from scratch.

But I may be wrong!

>> $tce = t3lib_div::makeInstance('t3lib_TCEmain');
>> $tce->stripslashes_values=0;
>> $cmd['pages'][551]['copy'] = 1822;
>> $tce->start(array(),$cmd);
>> $tce->process_cmdmap();
>> t3lib_BEfunc::getSetUpdateSignal('updatePageTree');
>>
>> $id = $GLOBALS['TYPO3_DB']->sql_insert_id();
>> echo $id ;
>>
>> A copy of page 551 is successfully made.  But $id is 0.  But how do I
>> get the id of the copy?

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en


More information about the TYPO3-english mailing list