Forum Moderators: open

Message Too Old, No Replies

Where to include the MySQL Connect and MySQL Close statements?

Where Should I put it in my web pages

         

jimh009

4:57 am on Jul 29, 2006 (gmt 0)

10+ Year Member



Hi,

My new web site will be having multiple MySQL queries per web page. As such, I was wondering where I should put the MySQL Connect and MySQL Close statement?

My first thought was to include the connect statement (in the code) right below my main menu (as nothing above that in the code will ever use MySQL). I would then have the close statement located right above the code for the footer.

By doing it this way, it would allow me to standardize the location of the statements while at the same time providing for flexibility in my queries, since the only place I'll be using MySQL is below my main menu and above the footer (code wise).

Would this be acceptable? Or is there another recommendation on where to place the connect/close statements?

Thanks

Jim

coopster

3:31 pm on Jul 29, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It really doesn't matter much to be quite honest with you. Placing the code in a similar place will make code maintenance much easier for you, that's for sure.