Jump to content


Photo

How can I add arrays together as one


  • Please log in to reply
1 reply to this topic

#1 Luvac Zantor

Luvac Zantor
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 14 December 2003 - 10:11 PM

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!

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 15 December 2003 - 06:21 PM

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...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.
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users