[TYPO3-dev] t3lib_db update column, increment, decrement

Peter Russ peter.russ at 4many.net
Tue Feb 14 21:38:10 CET 2012


As it's commonly said that this can't be done or not well known

SET <colname> = <colname> +/- <intValue>

here the solution how it works:

$GLOBALS['TYPO3_DB']->exec_INSERTquery(
'cachingframework_cache_hash',
array(
     'identifier'=>'supertest',
     'content' =>1
)
);
$offset = 1;
$GLOBALS['TYPO3_DB']->exec_UPDATEquery(
'cachingframework_cache_hash',
array(
     'content' => 'content + ' .$offset
),
'',
'',
'',
'content'
);

Hopes this helps.

-- 
Fiat lux! Docendo discimus.
_____________________________
uon GbR

http://www.uon.li
http://www.xing.com/profile/Peter_Russ



More information about the TYPO3-dev mailing list