MargateSteve Posted November 20, 2010 Share Posted November 20, 2010 I am trying to clean up some code in my pages and would like some advice on good practice for the structure. Initially the code was generated by Dreamweaver and everything relating to the queries were place at the very top of the page, outside any of the HTML. A lot of the coding help I have had from this forum has put the queries etc in with the actual output php. Is there any right or wrong way to do this? I assume both ways have their pros and cons and both generate the same end result but I want to start getting into good habits before it is too late!! Thanks in advance Steve Link to comment https://forums.phpfreaks.com/topic/219304-query-positioning-within-a-page/ Share on other sites More sharing options...
BlueSkyIS Posted November 20, 2010 Share Posted November 20, 2010 I assume ... both generate the same end result No, not necessarily and often not at all. Sometimes there is PHP processing with no HTML at all, or processing that redirects a user to another page before any HTML is displayed. On the other hand, sometimes PHP is used to dynamically generate form elements like <select>, where there is no option but to execute PHP within the HTML. It all comes down to what you need to do. Link to comment https://forums.phpfreaks.com/topic/219304-query-positioning-within-a-page/#findComment-1137238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.