![]() |
Basic Report output i can't get my head around - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Basic Report output i can't get my head around (/showthread.php?tid=32399) |
Basic Report output i can't get my head around - El Forum - 07-22-2010 [eluser]TornUp[/eluser] Hi All! Going to sound really n00b like and ask for some help in a query/output I'm trying to-do. im currently producing an electronic phone list in CI, all users are stored in a tables with the following layout: Users Code: id Location: Code: id Now what I am trying to achieve is the following: New York: John Smith Fred Jones Katie bing London: Emma flop Andy Flip and so on, and so on.... can someone help me getting my head around the MySql query/passing it to the view via the controller. I see it done all the time, but the concept confuses me! ![]() Many Thanks Tom Kirby. Basic Report output i can't get my head around - El Forum - 07-22-2010 [eluser]mddd[/eluser] You need to JOIN the list of locations to the list of people. Then you can loop through the results. Each result will contain the person and his/her location. If the location changes, you know you've gone to the next list of people. Like so: Code: // get the info Basic Report output i can't get my head around - El Forum - 07-22-2010 [eluser]TornUp[/eluser] Hi Mddd, Iv done MYSql Joins before, I was just not sure on how to loop through the items so they all sit under one title till there is nothing left for that title, then it jumps to the next title... Kinda got my head around your code.. will give it a try.. Thanks! ![]() Basic Report output i can't get my head around - El Forum - 07-22-2010 [eluser]TornUp[/eluser] Hi All, So iv run into a slight problem... the loop above is PERFECT! but.... i need to put somthing on the end, once the loop has finished... for example: %insert @ Top% <div class="title>LOCATION TITLE</div> %loop start% <div class="main numbers"> NAME - Number - Ext - Etc.. </div> %loop end% %insert @ Bottom% <div class="closing"></div> I just can't get my head around how i make it only output the closing div ONCE once the loop has finished! ![]() Help!? Basic Report output i can't get my head around - El Forum - 07-23-2010 [eluser]TornUp[/eluser] Sorry to bump this.... But I am really in need of finishing this project off today? can anyone help? Basic Report output i can't get my head around - El Forum - 07-23-2010 [eluser]mddd[/eluser] I think it's not so hard. Just a bit of logical thinking. If I get you right, you need to show the 'closing' div after each location? Well, how do you know it's the last one? You could look at the next one coming up. Like so: Code: // show the info |