pg_query($db, 'BEGIN'); $WatchLists = new WatchLists($db); if ($WatchLists->DeleteAllLists($User->id) == 1) { pg_query($db, 'COMMIT'); } else { pg_query($db, 'ROLLBACK'); } break; case 'empty': pg_query($db, 'BEGIN'); $WatchList = new WatchList($db); while (list($key, $WatchListIDToEmpty) = each($_POST['wlid'])) { if ($Debug) { echo "\$key='{$key}' \$WatchListIDToEmpty='{$WatchListIDToEmpty}'<br>"; } $EmptydWatchListID = $WatchList->EmptyTheList($User->id, pg_escape_string($WatchListIDToEmpty)); if ($EmptydWatchListID != $WatchListIDToEmpty) { die("Failed to Empty '{$WatchListIDToEmpty}' (return value '{$EmptydWatchListID}')" . pg_last_error()); } if ($Debug) { echo 'I have emptied watch list id = ' . $WatchListIDToEmpty . '<br>'; } } pg_query($db, 'COMMIT'); break; case 'empty_all': pg_query($db, 'BEGIN'); $WatchList = new WatchList($db); $NumRows = $WatchList->EmptyAllLists($User->id, pg_escape_string($WatchListIDToEmpty)); if (!isset($NumRows)) { die("Failed to Empty '{$WatchListIDToEmpty}' (return value '{$EmptydWatchListID}')" . pg_last_error());