Gossamer Forum
Home : Products : DBMan : Customization :

Adding fields together?

Quote Reply
Adding fields together?
Hello. I would like to use DB man to track how many letters and care packages etc have been sent to soldiers overseas.

I am already fairly familar with seting up and modifing DB Man but would like to have a running total of all the 'letters' and all the 'movies' etc.

So... I would setup a field for each of the following:

#_Letters
#_CarePackages
#_Movies
#_Emails

Then the user would enter the number of each they sent and hit the submit button to add the record to the database. So I would like to have a

Total_#_of_Letters
Total_#_of_Movies
Total_#_of_CarePackages
Total_#_of_Emails
Grand_Total_of_Everything

any ideas on how to modify DB Man to do this??? I would like to have the totals to where I could use SSI or something to display them on a web page without users having to do into the actual database to see it.

Thank you all for your time,
Melyssa
Quote Reply
Re: Adding fields together? In reply to
Maybe you can do something with the second part of the Thread: http://www.gossamer-threads.com/...m12/HTML/001933.html .
I spoke about a temperaly directory with counting up-files in it. You can name there any 'temp_name-file' as you like. Then let it update it by cron once or twice a day. This work very good for me and the database don't be rewrite every time a record is viewed.

Hope this helps,
--------
Mart.
Quote Reply
Re: Adding fields together? In reply to
Problem is this wouldn't be a hit counter. I would need to take the number entered by the user to add to the old number, or the total.

Can I have maybe a letter.txt file and an email.txt file (etc...) on the server and have db man take the number of letters stored in letters.txt and add the number of letters just entered to that and replace the old total with the new one?

Sound easy, but I have NO IDEA how to set it up in CGI/Perl. Please forgive my stupidity.
Quote Reply
Re: Adding fields together? In reply to
Sorry, I don't understand what you mean.
Maybe someone else??
Quote Reply
Re: Adding fields together? In reply to
Can it do something like this:

Open letter.txt
Suck in TotalLetters (in the file)
set TotalLetters = TotalLetters + LettersSent
Write TotalLetters back to letters.txt

Does that make more sense?

Sorry to be a pain