months units stationName
| January | 14,629 | Station 1 |
| February | 19,161 | Station 1 |
| March | 13,388 | Station 1 |
| April | 10,522 | Station 1 |
| May | 15,941 | Station 1 |
| June | 10,650 | Station 1 |
| July | 11,005 | Station 1 |
| August | 19,141 | Station 1 |
| September | 13,228 | Station 1 |
| October | 22,452 | Station 1 |
| November | 15,757 | Station 1 |
| December | 20,464 | Station 1 |
| January | 15,654 | Station 2 |
| February | 16,718 | Station 2 |
| March | 14,839 | Station 2 |
| April | 12,791 | Station 2 |
| May | 12,838 | Station 2 |
| June | 14,229 | Station 2 |
| July | 15,616 | Station 2 |
| August | 14,633 | Station 2 |
| September | 19,544 | Station 2 |
| October | 16,592 | Station 2 |
| November | 14,746 | Station 2 |
| December | 15,425 | Station 2 |
| January | 233,796 | Station 3 |
| February | 82,309 | Station 3 |
| March | 198,876 | Station 3 |
| April | 34,959 | Station 3 |
| May | 367,101 | Station 3 |
| June | 430,691 | Station 3 |
| July | 220,664 | Station 3 |
| August | 318,963 | Station 3 |
| September | 106,403 | Station 3 |
| October | 248,531 | Station 3 |
| November | 339,486 | Station 3 |
| December | 174,552 | Station 3 |
| January | 190,048 | Station 4 |
| February | 38,460 | Station 4 |
| March | 178,998 | Station 4 |
| April | 49,516 | Station 4 |
| May | 256,988 | Station 4 |
| June | 307,099 | Station 4 |
| July | 201,678 | Station 4 |
| August | 215,608 | Station 4 |
| September | 108,847 | Station 4 |
| October | 222,191 | Station 4 |
| November | 235,785 | Station 4 |
| December | 103,880 | Station 4 |
I'm struggling to get the info from the table. Here's PHP the code I used:
# Months $strQuery = "SELECT distinct months FROM stations_new"; $result = mysql_query($strQuery); # Add category names $FC->addCategoryFromDatabase($result, "months");
# Stations # Create a new dataset
$strQuery = "select units, months, stationName from stations_new GROUP BY stationName"; $result = mysql_query($strQuery); $FC->addDatasetsFromDatabase($result, "stationName", "units");
# Add chart values for the above dataset $strQuery = "select months, units, stationName from stations_new"; $result = mysql_query($strQuery); $FC->addDataFromDatabase($result, "units");
This code is not working at all. What am I doing wrong? Is there anyway to simplify the table structure? The table above is very cumbersome. Eventually I would need it to be by week and days of the year. To do that the table would be 365 x 4 rows long. Is there a better way to do this?
Thanks!
Karen

Back to top
MultiQuote
