doughemi Posted March 18, 2013 Posted March 18, 2013 I have a table with fields State, StateDataThisYear, and StateDataNextYear. I want to end up with two html tables (one for this year and one for next) with the StateData in the table. The StateData is either the state name and a link to an anchor further down the page, or just the state name. This table will be used as a Table of Contents for other data on the page. The objective is to allow the page user to quickly see if there are events in a state and navigate to details if there are. I think I want the data in a php array formatted like this: Array ( [<<State>>] => Array ( [0] => <<StateDataThisYear>> [1] => <<StateDataNextYear>> ) ... ) and then use a loop to put the StateData in its respective table. I haven't been able to get the syntax right in the foreach loop of extracted records to obtain this array. Can someone help me with the php syntax, or suggest a better way?
webko Posted March 20, 2013 Posted March 20, 2013 How does the array naturally return? I'd probably just use two loops on the result set to build the two tables...
doughemi Posted March 20, 2013 Author Posted March 20, 2013 Thanks, Tim. That's what I ended up doing. I finally realized that I didn't need to use the combined data anywhere else, so the fancy-schmancy multidimensional array wasn't necessary.
Recommended Posts
This topic is 4522 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now