Re: [PHP] Average Number For Math Functions

2002-09-01 Thread David Robley
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Ok I think your definently going in the right direction - when I put this > into my "series" I seem to be getting this message for each result: > "Resource id #40" or some other number that in some way represents > something? Any Clue?

Re: [PHP] Average Number For Math Functions

2002-08-30 Thread JohnP
ction which automatically selects the total of a > column. > > > > -VolVE > > > > - Original Message - > > From: "JohnP" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, August 29, 2002 21:25 > > Sub

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread @ Edwin
> >I am still very new to PHP so things are still a little foreign to me - what >exactly is the SUM finction - I tried to locate one on both the PHP and >MySQL site but found nothing! http://www.mysql.com/doc/en/Group_by_functions.html#IDX1364 Well, it's close to "nothing" but if you study ho

RE: [PHP] Average Number For Math Functions

2002-08-29 Thread Martin Towell
Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 3:10 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Average Number For Math Functions I am still very new to PHP so things are still a little foreign to me - what exactly is the SUM finction - I tried to locate

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread JohnP
MAIL PROTECTED]> > Sent: Thursday, August 29, 2002 21:25 > Subject: Re: [PHP] Average Number For Math Functions > > > > Ok so how do I sum up an entire column in my db? > > For example if one row is : 1 , the next is 2, and the next is 1 - I need > to > > have

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread VolVE
What database are you using? MySQL has a SUM function which automatically selects the total of a column. -VolVE - Original Message - From: "JohnP" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 29, 2002 21:25 Subject: Re: [PHP] Average Num

RE: [PHP] Average Number For Math Functions

2002-08-29 Thread David Freeman
> Ok so how do I sum up an entire column in my db? > For example if one row is : 1 , the next is 2, and the next > is 1 - I need to > have a total of 4 and the be able to divide by the num_rows > > The problem I ma having is the "inside" row addition If you're doing it on values from a d

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread Andrew Brampton
I can't seem to see a pre-built functions but here is one I just wrote in my email client: function average($numberArray) { $sum = 0; for ($i=0;$i To: <[EMAIL PROTECTED]> Sent: Friday, August 30, 2002 1:55 AM Subject: [PHP] Average Number For Math Functions Ok I looked at all the math f

RE: [PHP] Average Number For Math Functions

2002-08-29 Thread Dave at Sinewaves.net
if i remember 4th grade math class correctly... $value) { $total += $array_of_the_numbers[$key]; ++$count; } // wow, that's a toughie! $average = $total / $count; // then you could make it pretty $pretty_average = number_format($average, 1); ?> booyah. :) dave -Origina

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread VolVE
Can't you just count the elements and then divide the total by the count? It seems pretty obfuscating to consider a function that takes an unknown number of elements, unless it were an array... still, seems pretty easy to count and divide total... doesn't it? -VolVE > - Original Message ---

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread Steve Edberg
At 05:55 PM 8/29/02 , JohnP wrote: >Ok I looked at all the math functions for PHP but saw no way of returning >the average of a set of numbers - I plan on using this for a rating system >- any help? > >-- >John Nope - you'll have to 'roll your own' by looping though the set, or (if you have v

Re: [PHP] Average Number For Math Functions

2002-08-29 Thread JohnP
Ok so how do I sum up an entire column in my db? For example if one row is : 1 , the next is 2, and the next is 1 - I need to have a total of 4 and the be able to divide by the num_rows The problem I ma having is the "inside" row addition "Martin Towell" <[EMAIL PROTECTED]> wrote in message [

RE: [PHP] Average Number For Math Functions

2002-08-29 Thread Martin Towell
just sum them up and divide by the count - making sure to deal with a count of zero -Original Message- From: JohnP [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 10:56 AM To: [EMAIL PROTECTED] Subject: [PHP] Average Number For Math Functions Ok I looked at all the math functio