kirk112 Posted October 17, 2006 Share Posted October 17, 2006 I have a query that selects:id initals value1 sk 132 sk 153 ge 134 hy 136 me 167 sk 148 hy 15What I need to do is display the information in the following format, for the life of me I can not work howSK GE HY ME13 13 13 1613 151313 52 13 18 16 TotalThank you for your time. Totally stumped! ??? Quote Link to comment Share on other sites More sharing options...
radar Posted October 17, 2006 Share Posted October 17, 2006 This sort of resembles an issue that I am having with my arrays... I am working on figuring it out and when I do I'll post something here to help you -- unless someone does before hand... Quote Link to comment Share on other sites More sharing options...
kirk112 Posted October 20, 2006 Author Share Posted October 20, 2006 RadarJust wondering if you manage to work out how to achieve this? Been trying for the last couple of days and can't find a way of getting it to work properly.Cheers Quote Link to comment Share on other sites More sharing options...
btherl Posted October 20, 2006 Share Posted October 20, 2006 Looks like a course exercise to me :) I think that any way to do it will be messy.I would do it like this:1. Rearrange the data into an array using initials as the index, like:array( 'sk' => array(13, 15, 14), 'ge' => 13);2. Print out the header ("SK GE HY ME");3. Print out the values, using an index variable to step through. Ie, for ($i = 0; $i < $num_values; $i++) { print values in index $i for each initial }That algorithm will work. It's not elegant, but I can't think of any elegant way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.