## User Tag List

I have a league table, and I want to plot the weekly, monthly changes into a line graph. However im stumped how to get the info into the array. I know its simple but I just cant get my head around it, im sure im having a blonde moment.

For example sake I have limited the no of groups in the league.

My sql query (searching for the groups by league outputs the following) for the past 5 days outputs. I have put a space between each day for ease of reading.

Name, Positions, League.
Aber, 1, LBPrem
Borth,2,LBPrem
Card,3,LBPrem

Aber, 1, LBPrem
Bort, 2, LBPrem
Card, 3, LBPrem

Bort, 1, LBPrem
Aber, 2, LBPrem
Card, 3, LBPrem

Bort, 1, LBPrem
Aber, 2, LBPrem
Card, 3, LBPrem

Card, 1, LBPrem
Aber, 2, LBPrem
Bort, 3, LBPREM

Now what I need to do is get all this info into an array. The position plotted as x axis and the name as y axis.

So I would need
\$xaxis1 = array(1,1,2,2,2);
\$xaxis1name = Aber;

\$xaxis2 = array(2,2,1,1,3);
\$xaxis2name= Bort;

\$xaxis3 = array(3,3,3,3,1);
\$xaxis3name = Card;

So for each name in the group, I need to collect all the positions together into an array.

Whats the best way to do this, im a little stumped. Although i have spent the past 48 hours passing Kidney stones which is very painful!

2. What i would do is use three parallel arrays. One for each name, position and league.

Let me know if you still need help with this.

3. Thanks for the tip.

The \$xaxis1, \$xaxis2, \$xaxis3 etc has to hold the positions for the graph. And each line has to be tied to a team (aber, card, bort). However there are actually 10 groups in the league, and those ten teams could change daily.

So on day one, aber and bort may not actually be in the league, but then might be for days 2-5 etc.

So I need to basically pull all the positions for each name. So although only 10 places in the league, in a week, there could be 70 different names which have got into the top 10 of that league. Allthough in reality its usually only 20 or so. what I need to do is, go through and pull each position for each name. But as a name might be in the table 10 times, its difficult. It needs to search through and look for that name and then get the position each time it shows up.

i suppose it might be worth going back to the table, and looking at where data is entered into the table and maybe put the names in their own table, so they are only in the DB once, with a name ID. Hmm, thoughts?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•