hi Everyone,
Need a little help please. I am trying to figure out the code on how I would be able to display the monthly odometer difference. For example the difference between the last reading and the previous is 96. I would like that figure to be visable under the Monthly Mileage column in the same row of the last entry and so on and so forth. I\'m at a lost for the past 2-weeks. Any help would be gratefully appreciated.
Date: Odometer Reading: Monthly Mileage:
2002-08-01 631
2002-07-01 535
2002-06-01 492
The code in use now:
$sql = \"
SELECT *
FROM mileage, lsv
WHERE mileage.vid = \\"$vid\\"
AND mileage.vid = lsv.vid
ORDER BY mileage.stop DESC
\";
$result = @($sql,$connection) or die(\"Couldn\'t execute query.\");
$the_mileage = \"
<table width=375 cellpadding=2 cellspacing=2 border=0>
<tr>
<td bgcolor=#800000 width=125><font size=1 face=arial color=#ffffff>Date:</font></td>
<td bgcolor=#800000 width=125><font size=1 face=arial color=#ffffff>Odometer Reading:</font></td>
<td bgcolor=#800000 width=125><font size=1 face=arial color=#ffffff>Monthly Mileage:</font></td>
</tr>
\";
while ($row = mysql_fetch_array($result)) {
$id = $row[\'id\'];
$vid = $row[\'vid\'];
$stopdate = $row[\'stopdate\'];
$stop = $row[\'stop\'];
$reg = $row[\'reg\'];
$sn = $row[\'sn\'];
$org = $row[\'org\'];
$vco_n = $row[\'vco_n\'];
$vco_e = $row[\'vco_e\'];
$the_mileage .= \"<tr>
<td bgcolor=#808080 width=125><font size=1 face=arial>$stopdate</font></td>
<td bgcolor=#808080 width=125><font size=1 face=arial>$stop</font></td>
<td bgcolor=#808080 width=125><font size=1 face=arial>$diff</font></td>
\";
}
$the_mileage .= \"</tr></table>\";
Thanks for any help.
:o) Ivan