Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculations

Status
Not open for further replies.

sparky68

Programmer
Feb 27, 2002
11
0
0
US
whats the best way to preform calculations on a page using data from a db? like if i had 3 numbers, wanted them sum'd and avg. is it best not to have the page do it but instead have the db do it in a query and update the table?
 
Best is a subjective term - if you are going to do this once a week, then any method that yeilds the correct value would work. However, if this calculation is going to be done by every visit to your page and by 1000's of visitors, then you need to determine the most cost effective solution. Another however, what if this calculation take a lot of time, you may want to "think out-side the box" and do the calculation elsewhere and just have the visitors retrieve the already calculated value (even if you have to calculate 100 such values, it may be better in the long run).

So The BEST solution is always related to the reasons behind it. Good luck! Einstein47
(How come we never see the headline, "Psychic Wins Lottery"?)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top