Fast Uncompromising Discussions. FUDforum will get your users talking.
Radicore v1.72.0 Apache Version 2.2.21 PHP Version 5.3.8 MySQL Version 5.5.16 1. Use updateSelection with multiple SET like this: function _cm_post_updateRecord ($rowdata, $old_data) { $a = 1; $b = 2; $where = "'{$rowdata['lft']}'<lft AND rgt<'{$rowdata['rgt']}'"; $replace = "lvl='lvl+{$a}', lft='lft+{$b}', rgt='rgt+{$b}'"; this->updateSelection($where, $replace); return $rowdata; } // _cm_post_updateRecord 2. Doing the above will result in: Fatal Error: Cannot extract token from: ', lft='lft+2', rgt='rgt+2'' (# 256). 3. Had to rewrite into something like below in order to avoid this fatal error: function _cm_post_updateRecord ($rowdata, $old_data) { $a = 1; $b = 2; $where = "'{$rowdata['lft']}'<lft AND rgt<'{$rowdata['rgt']}'"; $replace = "lvl='lvl+{$a}'"; this->updateSelection($where, $replace); $replace = "lft='lft+{$b}'"; this->updateSelection($where, $replace); $replace = "rgt='rgt+{$b}'"; this->updateSelection($where, $replace); return $rowdata; } // _cm_post_updateRecord
Re: updateSelection cannot extract token
Firstly, if you wish to increment a numeric column you must use "lvl=lvl+1" and not "lvl='lvl+1'". If you enclose the update value in quotes it will be treated as a string. Secondly, I have made some slight code changes in the attached zip file which should help.
I knew I'd get it right eventually