Jump to content

Archived

This topic is now archived and is closed to further replies.

Luvac Zantor

How can I add arrays together as one

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!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

×

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.