<?php
        $query = "SELECT id, price, price3, price6, price12 FROM package";
        $result_package = mysql_query($query) or die("ERROR (updateAllDomainPackagePrice): $query");
        while(list($packageid,$tPrice,$tPrice3,$tPrice6,$tPrice12) = mysql_fetch_row($result_package)){
            $query = "SELECT id,paymentterm FROM domains WHERE recurring=1 AND plan=".$packageid;
            $result = mysql_query($query) or die("ERROR (updateAllDomainPackagePrice): $query");
            while(list($tDomainID,$tPaymentTerm) = mysql_fetch_row($result)){
                switch($tPaymentTerm){
                       case 1:
                            $query2 = "UPDATE recurringfee SET amount=$tPrice WHERE billingtypeid=-1 AND appliestoid = $tDomainID";
                            break;
                       case 3:
                            $query2 = "UPDATE recurringfee SET amount=$tPrice3 WHERE billingtypeid=-1 AND appliestoid = $tDomainID";
                            break;
                       case 6:
                            $query2 = "UPDATE recurringfee SET amount=$tPrice6 WHERE billingtypeid=-1 AND appliestoid = $tDomainID";
                            break;
                       case 12:
                            $query2 = "UPDATE recurringfee SET amount=$tPrice12 WHERE billingtypeid=-1 AND appliestoid = $tDomainID";
                            break;
                }
                $result2 = mysql_query($query2) or die("updateAllDomainPackagePrice: $query2");
            }
        }
?>
