Re: Re: [PHP] Need to get total number from query!

From: Date: Fri, 15 Dec 2000 17:31:21 +0000
Subject: Re: Re: [PHP] Need to get total number from query!
Groups: php.general 
Request: Send a blank email to php-general+get-30546@lists.php.net to get a copy of this message
I'm not sure what you are asking, or how your getting 10,20,30 from count(*), but... If your asking how you can get the SUM of the 'numbers': If you are looping thru each record to print it out, you can add the value to a variable ($sum = $sum + $number) on each iteration of the loop. Might your DB have a function to do this as well? Chris On Thu, 14 Dec 2000, Joe Stump wrote: > Date: Thu, 14 Dec 2000 22:47:03 -0800 > To: Sandeep Hundal <sandeep_wde@yahoo.com> > From: Joe Stump <joe@earth.care2.com> > Subject: Re: [PHP] Need to get total number from query! > > Take your limit off of the query if there is one. > > --Joe > > On Thu, Dec 14, 2000 at 10:45:57PM -0800, Sandeep Hundal wrote: > > No, that only gives me "3", which is the number of rows actually > > returned..... i need a sum of the answers basically... the oens on > > the right. > > > > > > --- Joe Stump <joe@earth.care2.com> wrote: > > @mysql_num_rows($result) > > ??? > > > > > > --Joe > > > > > > On Thu, Dec 14, 2000 at 10:24:19PM -0800, Sandeep Hundal wrote: > > > > Just a quick question. I have a query as such: > > > > SELECT q9 AS names, count(*) AS numbers FROM table GROUP BY q9 > > > ORDER > > > > by names desc; > > > > > > > > this gives me something like: > > > > ------------------------ > > > > ans1 : 10 > > > > ans2 : 20 > > > > ans3 : 30 > > > > ------------------------ > > > > > > > > what i would like is a way to get the total of those 3 figures > as > > > a > > > > variable and plug that in at the bottom... is there a quick > way? > > > > > > > > thanks! > > > > > > > > Sunny > > > > > > > > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Yahoo! Shopping - Thousands of Stores. Millions of Products. > > > > http://shopping.yahoo.com/ > > > > > > > > -- > > > > PHP General Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > > For additional commands, e-mail: php-general-help@lists.php.net > > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > > > --- > > > Joe Stump > > > PHP Programmer > > > www.Care2.com > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > > For additional commands, e-mail: php-general-help@lists.php.net > > > To contact the list administrators, e-mail: > > > php-list-admin@lists.php.net > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Shopping - Thousands of Stores. Millions of Products. > > http://shopping.yahoo.com/ > > --- > Joe Stump > PHP Programmer > www.Care2.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net >

« previous php.general (#30546) next »