>- see footer for list info -< Duncan, Does that mean the PlayersArray would end up looking something like: [1][playersStruc.Red, playersStruc.Yellow, playersStruc.TotalGoals] [2][playersStruc.Red, playersStruc.Yellow, playersStruc.TotalGoals] [3][playersStruc.Red, playersStruc.Yellow, playersStruc.TotalGoals] etc up to 25 Or is that not an accurate way to describe that arrangement of data?
On 9/7/05, Duncan Cumming <[EMAIL PROTECTED]> wrote: > > >- see footer for list info -< > something like: > PlayersArray = ArrayNew(2) > <cfquery name="getData"> > SELECT * > FROM MatchPlayer > ORDER BY PlayerID > </cfquery> > <cfloop query="getData"> > PlayerStruct = StructNew() > PlayerStruct.Reds = getData.reds > PlayerStruct.Yellows = getData.yellows > ... etc > PlayersArray[getData.CurrentRow][1] = getData.playerID > PlayersArray[getData.CurrentRow][2] = Duplicate(PlayerStruct) > </cfloop> > > You then have a 2D array with an entry for each player. The first element > in each row is the player ID, the second element in each row is the struct > of that player's individual bits and pieces. > > But yes, maybe it's more an issue of db design... > > > Duncan Cumming > New Media Developer > Customer Relations Management / Education > Fife Council > 700 4105 / 01592 414105 > > Duncan Cumming > New Media Developer > Customer Relations Management / Education > Fife Council > 700 4105 / 01592 414105 > > >>> [EMAIL PROTECTED] 07/09/2005 12:09:33 >>> > >- see footer for list info -< > This may be a tad difficult to explain but I'll try... > I need help with the best way to approach this problem.. I am thinking > maybe a combination of structures and arrays but I'm not very experienced > combining them or using structures... > I have a DB holding football data about a team and players.... > There is a table called MatchPlayer which holds data about all the players > in a squad for each game of a season.. so it gets updated each week with 25 > records.... one for each squad member for the last game...and holds > details about their position for that game, goals scored, yellow cards, red > cards, etc > There is another table called Player, which holds details about a player's > total stats for the season and has one record per squad member and has total > goals, yellows, reds etc. > What i would like to do is write a page to update this Player table with > info from MatchPlayer, by looping around all the records in MatchPlayer (25 > * amount of games so far) and for each player making a sum of the goals, > yellow, red cards etc. from each of the matches to make a season total > Then I want to go and update the Player table with this data > I am not sure of the best way to approach this and hold the data before > doing the update to make sure I am doing it efficiently. > The data I end up with will be something like > goals1=1 > goals2=0 > goals3=1 > ... up to 25 > yellow1=0 > yellow2=0 > yellow3=1 > upto 25 > red1=0 > red2=0 > red3=1 > upto 25 > where each number appended to the variable name represents a playerid in > Players table. > Is it best to try and store all this in an array and structure combination > e.g. a 25 element array each element representing a player, where each > element has a structure which contains goals, yellows, reds that represent > the data for that individual player? > Then when doing the updateto Players.... I loop through each array element > to update each player and within each element loop through the structure > keys to update the individual stats for that player? > I am quite keen to start using struct/arrays more and this seemed like > perhaps candidate data/logic for doing so? > (If you're still with me and have the inclination to answer - thanks !) > > -- > Rich > _______________________________________________ > > For details on ALL mailing lists and for joining or leaving lists, go to > http://list.cfdeveloper.co.uk/mailman/listinfo > > -- > CFDeveloper Sponsors:- > >- Hosting provided by www.cfmxhosting.co.uk<http://www.cfmxhosting.co.uk>-< > >- Forum provided by www.fusetalk.com <http://www.fusetalk.com> -< > >- DHTML Menus provided by www.APYCOM.com <http://www.APYCOM.com> -< > >- Lists hosted by www.Gradwell.com <http://www.Gradwell.com> -< > >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help > -< > > > > ********************************************************************** > This email and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are addressed > and should not be disclosed to any other party. > If you have received this email in error please notify your system manager > and the sender of this message. > > This email message has been swept for the presence of computer viruses but > no guarantee is given that this e-mail message and any attachments are free > from viruses. > > Fife Council > Tel: +44 (0) 1592 414141 > ********************************************************************** > > _______________________________________________ > > For details on ALL mailing lists and for joining or leaving lists, go to > http://list.cfdeveloper.co.uk/mailman/listinfo > > -- > CFDeveloper Sponsors:- > >- Hosting provided by www.cfmxhosting.co.uk<http://www.cfmxhosting.co.uk>-< > >- Forum provided by www.fusetalk.com <http://www.fusetalk.com> -< > >- DHTML Menus provided by www.APYCOM.com <http://www.APYCOM.com> -< > >- Lists hosted by www.Gradwell.com <http://www.Gradwell.com> -< > >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help > -< > -- Rich _______________________________________________ For details on ALL mailing lists and for joining or leaving lists, go to http://list.cfdeveloper.co.uk/mailman/listinfo -- CFDeveloper Sponsors:- >- Hosting provided by www.cfmxhosting.co.uk -< >- Forum provided by www.fusetalk.com -< >- DHTML Menus provided by www.APYCOM.com -< >- Lists hosted by www.Gradwell.com -< >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
