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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.