The reason why this is failing is that when I construct the sql UPDATE statement I put quotes around all the values, so instead of producing "rgt=rgt+2" I get "rgt='rgt+2'", and when you try to put a string into a number MySQL replaces it with zero.
The solution is relatively simple. Go to the updateRecord() method in file 'dml.mysql.class.inc' and where you see
// build update string from non-pkey fields
$update = '';
foreach ($fieldarray as $item => $value) {
// use this item if it IS NOT part of primary key
if (!in_array($item, $this->primary_key)) {
if (is_null($value) or strtoupper(trim($value)) == 'NULL') {
// null entries are set to NULL, not '' (there is a difference!)
$update .= "$item=NULL,";
} else {
// change to the new value
$update .= "$item='" .mysql_real_escape_string($value, $this->dbconnect) ."', ";
} // if
} // if
} // foreach
you should change it to the following:
// build update string from non-pkey fields
$update = '';
$pattern = '/(integer|decimal|numeric|float|real)/i'; <*** NEW
foreach ($fieldarray as $item => $value) {
// use this item if it IS NOT part of primary key
if (!in_array($item, $this->primary_key)) {
if (is_null($value) or strtoupper(trim($value)) == 'NULL') {
// null entries are set to NULL, not '' (there is a difference!)
$update .= "$item=NULL,";
new**> } elseif (preg_match($pattern, $fieldspec[$item]['type'], $match)) {
new**> // do not enclose numbers in quotes (this also allows 'value=value+1'
new**> $update .= "$item=$value,";
} else {
// change to the new value
$update .= "$item='" .mysql_real_escape_string($value, $this->dbconnect) ."', ";
} // if
} // if
} // foreach
Check if this works OK for you and I'll include this change in the next release.