Hi Everyone,
I am trying to display the difference between entries. I would like to view a column next to display the mileage diff from 2002-08-01 & 2002-07-01. Basically on july 1 my mileage was 535 and on aug 1 my mileage is 631, how many miles did I put on the vehicle? This will a continous display like below.
Date Mileage Difference
2002-08-01 631 96
2002-07-01 535 135
2002-06-01 400
Thanks for any help
:o) Ivan
My code looks like this so far:
$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>Stop Date:</font></td>
<td bgcolor=#800000 width=125><font size=1 face=arial color=#ffffff>Stop Mileage:</font></td>
<td bgcolor=#800000 width=125><font size=1 face=arial color=#ffffff>Total From Last Entry:</font></td>
</tr>
";
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$vid = $row['vid'];
$stopdate = $row['stopdate'];
$stop = $row['stop'];
$howmany = $row['howmany'];
$reg = $row['reg'];
$sn = $row['sn'];
$org = $row['org'];
$vco_n = $row['vco_n'];
$vco_e = $row['vco_e'];
$the_mileage .= "<tr>
<td bgcolor=#ECDC94 width=125><font size=1 face=arial>$stopdate</font></td>
<td bgcolor=#ECDC94 width=125><font size=1 face=arial>$stop</font></td>
<td bgcolor=#ECDC94 width=125><font size=1 face=arial>$thediff</font></td>