Jump to content

How can I add arrays together as one


Luvac Zantor

Recommended Posts

Let me clarify.

 

I have a database that keeps track of football stats based on the weekly games.

 

What ends up happening is that each player ends up with multiple entries based on the week they played. What I want to do is take all those entries, and create an output that adds all the stats. (ie. yards for week 1 and week 2 and week 3, etc..)

 

I was wanting to avoid having to create ANOTHER table to store things in (seemed redundant, since I figure there must be a way to pull multiple rows and \"add\" them together)

 

I\'ve been looking around for a few hours, but must be looking in the wrong place. (online and the PHP Bible).

 

Suggestions? thanks!

Link to comment
Share on other sites

I havent quite understood what you well. But you sound like using a GROUP CLAUSE in mysql . Check manual for more details.

 

http://www.phpfreaks.com/mysqlmanual.php

 

her is an example

 

select fdate,SUM(goals) from <table_name> group by fdate

 

Thsi query will display the date and the total. Dates that are same are grouped as one and only one entry is shown.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.