Jump to content

Query positioning within a page


MargateSteve

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.