|
If you are putting up too much queries at the top of the page -- and -- you have elements that may or may not show up on the page then you should consider re-arranging the code a tad bit.
Personally, I open queries close to where I am going to use them. So if it is some kind of a widget I place the query just before the widget (or inside the widget if possible). That way it is slightly easier for me to track of stuff -- no need to scroll all the way to the top to, for example, find if $rs_newest_properties contains an is_active field. In fact, if I later find that newest_properties need to be displayed on two pages I put the queries + code in another file.
Occasions where put queries before the <!DOCTYPE> is when I need to do some (sanity) checking (which almost always involve database queries); where failure means generating a 301/302/404/500 error.
Last edited by schwarzenneger; 01-24-2013 at 06:06 PM..
Reason: grammar
|