@MPDev Yorixz, Thank you
@MPDev:
The changes you introduced are not correct. Please look at the following two lines:
$deletions[] = "(`cdata` = '$ident[1]' AND `count` = '$data[0]' AND `ctype` = '$ident[0]' AND `cmisc` = '$data[2]')";
$insertions[] = "('$ident[1]', '" . ($data[0] + $data[1]) . "', '$ident[0]', '$data[2]')";
$data[0]+$data[1] is where the old count is added to the new count.