Matt,

You are looking at least 2 separate select queries - one to retrieve the
player data on a tournament by tournament basis and a second query to
'calculate' the summary data. Now, you will be needing the GROUP BY clause
in the second query while drawing on at least the player and appearances
tables (check out GROUP BY in the MySQL (I assume you are using MySQL)
online manual.) Then simply print out the results of the respective select
queries.

David Eisenhart


"Matt Macleod" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm building a site for my rugby club and I want to present players'
> data ie: number of appearances, points scored and so on.
>
> I have three tables in my database: a table of tournaments (date,
> location, opposition, etc), a table of players (name, contact details,
> position, etc) and a table of appearances (fixtureID, playerID, tries
> scored, penalties scored, cautions etc.
>
> When a player is selected from a drop-down list, their data will appear
> in a table by drawing from the 'appearances' table based on the player's
> ID thus:
>
> Player: Matt MacLeod
> ---------------------
> Tournament 1 / 19/01/2003 / 2 tries / 0 pens / 0 cautions
> Tournament 2 / 24/03/2003 / 4 tries / 3 pens / 1 caution
> Tournament 3 / 27/03/2003 / 0 tries / 3 pens / 0 cautions
>
> I then want to print the player's totals thus:
>
> 3 tournaments / 6 tries / 6 pens / 1 caution
>
> This is where I get stuck. I know how to display the data on a
> tournament by tournament bais, and get PHP to build an additional table
> row for each appearance by the player, but I am unsure of how to add up
> the columns and print the totals at the end of the table.
>
> Any help would be greatly appreciated.
> Thanks,
>
> Matt
>







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to