require_once("MDB2.php");
$db = MDB2::factory(DSN);
 $db->setFetchMode(MDB2_FETCHMODE_ASSOC); 
 $db->setOption('portability', MDB2_PORTABILITY_NONE);
 $db->loadModule('Extended');
foreach ($_POST['deleteCollectionIDs'] as $k => $v)
{
	$q = "DELETE FROM Collection_" . $v ." WHERE Collection_".$v."_". $_POST['deleteFieldIDs'][$k] ." = ".$_POST['deleteFieldValues'][$k]." ";
	$db->query($q);
}

$q = "DELETE FROM Collection_" . $_POST['parentCollectionID'] ." WHERE Collection_".$_POST['parentCollectionID']."_ID = ".$_POST['parentID'] ." ";
$db->query($q);
	
	header('Location: '. $_POST['originalURL']);
	die();