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?  Here is my SQL:

$rsum =mysql_query("select sum(rating) from ratings")or
die (mysql_error());

John



"Martin Towell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> if you have a table called "ratings" and a field called "score" in it,
then
> doing this will show you the sum of all the scores:
>
> select sum(score) from ratings;
>
> eg, if the scores were  5, 2, 5, 8, and 2 then this sql should return 22
> (unless I added it wrong... :/ )
>
> -----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 one on both the PHP and
> MySQL site but found nothing!
> Thanks ~ John
>
>
> "Volve" <[EMAIL PROTECTED]> wrote in message
> 02d901c24fd5$aba46020$7800a8c0@idiom">news:02d901c24fd5$aba46020$7800a8c0@idiom...
> > 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 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 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
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > > 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 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
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to