query("INSERT INTO `inventoryfolders` (folderName, type, version, folderID, agentID, parentFolderID ) VALUES ('$name', '$type', 1, '$id', '$owner', '$parent');"); if(!$res) $complete=false; else { // Let's bump the parent folder version number now $pfres = $DB->query("SELECT * FROM `inventoryfolders` WHERE folderID='$parent'"); if($pfres){ // The parent folder is valid. $row = $pfres->fetch_assoc(); $parentVersion = $row['version']; $parentVersion++; $DB->query("UPDATE `inventoryfolders` SET `version` = '$parentVersion' WHERE folderID='$parent'"); } } } die(json_encode(array( "done" => $complete, "type" => "S2CSimpleReply" ))); ?>