Welcome Guest, Not a member yet? Register   Sign In
Forced to run DB Query from View (Bad practice?)
#16

[eluser]drewbee[/eluser]
Argh.. I wouldn't recomend a recursive function that makes database queries. Think about it. For every child you are making a new call to the database. Iwould hate to have to manage that.

Take a look at this:
http://www.sitepoint.com/article/hierarc...a-database

It is the 'preorder tree transversal sitepoint', and you can get all the information you want in 1 query. (OR two queries if you need to identify the current category location); needless to say, this method is the best for performance.


Messages In This Thread
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 09:10 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 09:16 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 10:45 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 12:30 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 01:39 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 04:31 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 05:23 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 05:30 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-26-2008, 06:24 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 04:04 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 05:14 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 06:42 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 05-27-2008, 07:39 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-28-2008, 10:37 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-28-2008, 10:53 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 07:10 AM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 05:11 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 06:17 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 07:37 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 08:55 PM
Forced to run DB Query from View (Bad practice?) - by El Forum - 07-29-2008, 10:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB