updateSelection cannot extract token [message #2916] |
Sat, 17 March 2012 02:05 |
kong
Messages: 90 Registered: December 2011
|
Member |
|
|
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
|
|
|
|
|
|
|