March 18, 201312 yr 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?
March 20, 201312 yr Solution How does the array naturally return? I'd probably just use two loops on the result set to build the two tables...
March 20, 201312 yr Author 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.
Create an account or sign in to comment