...

View Full Version : How do I write code that keeps a log and updating info? PLEASEEEE HELP



porsche21
08-31-2007, 04:46 PM
I have a popup box that allows the user to submit the current amount of miles left on the vehicle after they are finished using that specific vehicle.

What I want is to be able to keep a log of the total miles and keep the miles updating after every use.

I have a table called trucks_miles with (4) fields called:
truck_id
start_miles
end_miles
truck_miles

How should I start my coding off to get this accomplished?:confused:

_Aerospace_Eng_
08-31-2007, 04:52 PM
What will you be using to store the miles? A database? A flat file? If a database what kind of database?

porsche21
08-31-2007, 05:03 PM
phpmyadmin

aedrin
08-31-2007, 07:30 PM
What will you be using to store the miles? A database? A flat file? If a database what kind of database?


I have a table called trucks_miles with (4) fields called:

I think few things other than a database have tables with fields :)

You're going to have to insert a new row into your table everytime someone submits the number of miles.

If they enter the start and end miles, then you can just pass that info into the insert, but if they don't, then you'll need to get the most recent entry from the table, take the end_miles column and add the new miles to it to get your end_miles for the insert.

You should probably add a date column to your table though, for this method to work. Also, why is there a field called truck_miles?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum