|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Getting The Average
Say I have a number is a table.
How would I divide a number that I pulled from a table and divide by what day it is, to get the average since the beginning of the week. Day 4: Wednesday - 50 in table Number in table: 50, mysql_query: 50 divide that by 4[day] = Average: 12.5 _________________________________ this is what I have so far... not sure if I'm doing this right... get the day PHP Code:
then, print("$average"); Last edited by zigote : April 2nd, 2003 at 10:08 PM. |
|
#2
|
|||
|
|||
|
You can use the date() function to retrieve the day in the week (number value):
PHP Code:
If you want to use 1 for Sunday and 7 for saturday, just add 1 to the value of $xDay. HTH!
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
very cool thanks, that helps alot
|
|
#4
|
|||
|
|||
|
Not a problem... Glad I could help!
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Getting The Average |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|