View Single Post
  #1 (permalink)  
Old November 3rd, 2003, 03:28 PM
wadesmart wadesmart is offline
Authorized User
 
Join Date: Oct 2003
Location: , Ok, .
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH5 pg 150 While Loops

I am getting errors:
"PHP Fatal error: Maximum execution time of 30 seconds exceeded in C:\Documents and Settings\Administrator\My Documents\My Work\PHP\Beg_PHP4\CH5\loan2.php on line 25, referer: http://localhost/PHP/Beg_PHP4/CH5/loan2.htm"

Actually, it is lines 21 through 30. On the following code, the <?php is line 4.

<?php
        $Duration = 0;
        switch ($_POST["loan"])
        {
            case 1000: $Interest = 5;
            break;

            case 5000: $Interest = 6.5;
            break;

            case 1000: $Interest = 8;
            break;

            default:
            echo "You didnt chose a loan package.";
            exit;
        }

        while ($_POST["loan"] >= 0 )
        {
            $Duration = $Duration + 1 ;
            $Monthly = $_POST["month"] - ($_POST["loan"] * $Interest / 100 ) ;
            if ($Monthly <= 0)
            {
                echo "You need larger monthly payments to pay off your loan." ;
            }
        $NLoan = $_POST["loan"] + $Monthly;
        }

            echo "This would take you $Duration months to pay this off at the interest rate of $Interest percent." ;
    ?>


Reply With Quote