$Otags = $Otags->fetchAll(PDO::FETCH_COLUMN); //echo $tags; $newTags = explode(",", $fileUpdate->getTags()); $addTags = array_diff($newTags, $Otags); $pos = sizeof($Otags); foreach ($addTags as $tag) { $pos++; $newTag = $conn->prepare("INSERT INTO `fileupload`.`options` (`group_id`, `option`, `sort`) VALUES ('4', :tag, :pos)"); $newTag->bindParam(':tag', $tag); $newTag->bindParam(':pos', $pos); $newTag->execute(); } } else { $fileUpdate->setTags($file->getTags()); } $fileUpdate->setType(issetOrBlank($_POST['file-type'])); $fileUpdate->setUploadDate($file->getUploadDate()); //see if active has changed //alias - see if it $fileUpdate->setActive(issetOrBlank($_POST['file-active']) == "" ? 0 : 1); if (!isset($_FILES["file-file"])) { //no new file $fileUpdate->setUploader($file->getUploader()); $fileUpdate->setSize($file->getSize()); $fileUpdate->setContentType($file->getContentType()); $fileUpdate->setExtension($file->getExtension()); $fileUpdate->setPath($file->getPath()); } else { //$file->setUploader( ($_SESSION['username'] != "" ? $_SESSION['username'] : '******' ); //from session? //$file->setSize($_FILES["file-file"]['size']); //$file->setContentType( issetOrBlank($_FILES["file-file"]['type']) );