PDA

View Full Version : Simple maths question


Nightfire
10-17-2002, 10:42 PM
I'm terrible at maths and I've got no idea how to make this add up right. There's 3 amounts I want showing, Total paid, Next payment, and Total.

Next payment is the Total divided by 3, which I have as

$nextamount = $row3[estimate]/3;

$nextamount being the next payment total and estimate being the Total. Now after they have made a small payment (less than $nextamount should be, I want it to add the remaining cash owed to $nextamount.

So basically, I need to somehow figure out how to add the amount they owe onto the nextpayment. Without making the rest of the payments out of count.

Spookster
10-17-2002, 11:53 PM
I am suddenly having nigtmarish flashbacks from math courses. lol

$total = 90; //gotten from database I imagine
$amtPaid = $_POST["amtpaid"]; //guessing this comes from the form they submit

echo "Previous Balance =" . $total;


$paymentDue = $total/3;

echo "You current payment due is " . $paymentDue;

echo "You paid " . $amtPaid;

$nextPayment = ($total - $amtPaid)/3;

echo "Your next payment will be " . $nextPayment;

$total = $total - $amtPaid;

//code for storing the total in the database goes here

echo "Current Balance =" . $total;


Is that what you are trying to do?

Nightfire
10-18-2002, 12:53 AM
It might be, I'll try it tomorrow. Gotta get to bed for bike test in the morning.