All pastes #430615 Raw Edit

Anonymous

public php v1 · immutable
·published 2007-04-09 03:26 UTC
rendered paste body
<?phprequire_once("../DB.php");require_once("../Util.php");require_once("../Band.php");$dbh = DB::dbh();//small snippet to clean out our bandstry{	cleanBands();	Util::debug("Success.");	exit;}catch( Exception $e ){	$dbh-> rollBack();	print_r($e);	Util::debug("failure");	exit;}print_r($band);// remove all bands from databasefunction 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 */