rollBack(); print_r($e); Util::debug("failure"); exit; } print_r($band); // remove all bands from database function cleanBands() { $dbh = DB::dbh(); $dbh-> beginTransaction(); $stmt = $dbh-> prepare(" SELECT band_id FROM bands"); $stmt-> execute(); $band_ids = array(); while( $info = $stmt-> fetch(PDO::FETCH_ASSOC) ) array_push($band_ids, $info['band_id']); for($i = 0; $i < count($band_ids); $i++) Band::fetch( $band_ids[$i] )-> remove(); $dbh-> commit(); } ?> /* OUTPUT: Success */