I have two fields I want to use all in one table called "fuel"
Fields are entered when fuel is purchased, bus unit number, odometer reading, date, driver and gallons, cost per gallon and total cost.
I need to use this data to calculate the MPG (miles per gallon) for each bus.
Two main fields being used..
1. Odometer Reading
I figured out that I want to take the first and the last odometer reading to calculate total miles in SQL and divide into the total gallons to get my MPG and got this far..
// Check connection
echo "Failed to connect to MySQL: " . mysqli_connect_error();
//$_POST['MPG'] is the array of forumla below
foreach($_POST['BusUnitNumber'] as $Bus_Number)
//The SQL Query
$x = mysql_query("SELECT MIN(OdometerReading) AS MilesStart FROM fuel");
$y = mysql_query("SELECT MAX(OdometerReading) AS MilesLast FROM fuel");
$z = mysql_query("SELECT SUM(Gallons) AS TotalGallons FROM fuel");
But I keep getting a parse error when running the report.
Maybe it is the output.. I am a fairly new coder and could use all the suggestions and help I can get PRETTY PLEASE.
Thanks from the Blonde Mermaid in Florida