Forced to run DB Query from View (Bad practice?) - 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: Forced to run DB Query from View (Bad practice?) (/showthread.php?tid=8658) |
Forced to run DB Query from View (Bad practice?) - El Forum - 07-29-2008 [eluser]Colin Williams[/eluser] An easy guideline to follow is "never run a query inside of a loop." The same result can be obtained by running a query and then looping. In fact, when using JOIN queries, you're almost ALWAYS going to need to loop through the result and build your own data structure. Quote:Actually, it’s a good way of creating a more modular application and reducing redundant code. Yeah, but not the ONLY way and probably not the BEST way. We won't go there again though... |