Thanks, but I'm still stuck! on a page using mysql how do I use the query
you gave me in a page?
this is my code now but it wont show the total groundballs, how do I make it
add up the sum of all the rows then output it onto the page for me?

<?php
$db = mysql_connect("db", "****", "***");
mysql_select_db("net3dual_lax",$db);
$search = mysql_query("SELECT SUM(groundballs) FROM rahs");
while($num=mysql_fetch_array($search)) {
printf ("Total groundballs: %s",$num["groundballs"]);
}
?>

Thanks!
--------------------------------------------
-Alex "Big Al" Behrens
E-mail: [EMAIL PROTECTED]
Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
[EMAIL PROTECTED]
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "Alex Behrens" <[EMAIL PROTECTED]>
Sent: Saturday, March 02, 2002 4:58 PM
Subject: Re: adding up row values....


> SELECT SUM(groundballs),  SUM(shots) FROM table_name;
> Also check out this:
> SELECT SUM(groundballs),  SUM(shots) FROM table_name GROUP BY team;
>
> On Sat, 2 Mar 2002 16:33:08 -0600, Alex Behrens said:
>
> > Hey Guys & Gals,
> >
> >  I'm rather new to mysql and need some help accomplishing a command for
my
> >  site:
> >
> >  I am looking to take a column in my table and add all the values, they
are
> >  all numerical. how do I do this? Below is an example of my table:
> >
> >
+-----------------+--------+------+---------+-------------+-------+---------
> >  -----+---------------+------------+
> >  | name            | number | team | penalty | groundballs | shots |
> >  faceoffs_won | faceoffs_lost | date       |
> >
+-----------------+--------+------+---------+-------------+-------+---------
> >  -----+---------------+------------+
> >  | pete nelson     |     29 | V    | none    |           7 |    17 |
> >  4 |             3 | 2002-03-01 |
> >  | darrenolson     |     91 | V    | none    |          13 |    32 |
> >  2 |             1 | 2002-03-02 |
> >  | vanguildertest4 |     17 | V    | none    |           5 |    15 |
> >  1 |             1 | 2002-03-01 |
> >
+-----------------+--------+------+---------+-------------+-------+---------
> >  -----+---------------+------------+
> >
> >  I want to add all of the values for the groundballs, shots, and
faceoffs,
> >  how do I make it add up row values?
> >
> >  Thanks!
> >  --------------------------------------------
> >  -Alex "Big Al" Behrens
> >  E-mail: [EMAIL PROTECTED]
> >  Urgent E-mail: [EMAIL PROTECTED] (Please be brief!)
> >  Phone: 651-482-8779
> >  Cell: 651-329-4187
> >  Fax: 651-482-1391
> >  ICQ: 3969599
> >  Owner of the 3D-Unlimited Network:
> >  http://www.3d-unlimited.com
> >  Send News:
> >  [EMAIL PROTECTED]
> >
> >
> >  ---------------------------------------------------------------------
> >  Before posting, please check:
> >     http://www.mysql.com/manual.php   (the manual)
> >     http://lists.mysql.com/           (the list archive)
> >
> >  To request this thread, e-mail <[EMAIL PROTECTED]>
> >  To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> >  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
>
> --
> ~~~~~~~~~~~~~~
> Ray B. Morris
> [EMAIL PROTECTED]
> http://www.webmastersguide.com
>
> Copyright 2002 Morris, All rights reserved
>
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to