View Single Post
Old 01-24-2013, 06:05 PM   PM User | #3
schwarzenneger
New Coder

 
Join Date: Sep 2009
Location: Pakistan
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
schwarzenneger is an unknown quantity at this point
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.
__________________
My Web Development Blog

Last edited by schwarzenneger; 01-24-2013 at 06:06 PM.. Reason: grammar
schwarzenneger is offline   Reply With Quote
Users who have thanked schwarzenneger for this post:
rgEffects (01-24-2013)