Math with mysql and php
Posted: Sun Nov 24, 2002 10:20 am
OK, hers my next big simple problem, I cant for the life of me figure out how to make $outstanding calculate down the table till eventully equelling 0...
how it is done rignt now it will do the math for each line individual, but not as a solid string... any tips?
Thanks.
how it is done rignt now it will do the math for each line individual, but not as a solid string... any tips?
Code: Select all
<?php
$querya = 'SELECT * FROM `duane` ORDER BY `date` DESC LIMIT 0, 30';
$result1 = mysql_query($querya, $connection) or die('error making querya');
?>
<table width="100%" border="3">
...
<tr>
<td>Amount Paid</td>
<td>Date Paid</td>
<td>WithStanding</td>
</tr>
<?php
while ($row = mysql_fetch_assoc($result1)) {
$paid = $rowї"payment"];
$payday = $rowї"date"];
$outstanding = 1700 - $rowї"payment"];
echo '<tr><td>',
$paid, '</td><td>',
$payday, '</td><td>',
$outstanding, '</td></tr>';
}
?>
...
<input type="submit" name="Submit" value="Submit">
</table>Thanks.