I just started PHP and want to make sure i am working with the database in the most efficient way. So say I have a page that calls three queries in different areas of the page. Which way is better:
A: I open a connection right before each query and close it right after.
B: opening a connection in the beginning then using that same connection to call each query and then closing the connect at the very end of the page.
My experience is that A is the best way to do it, though I am not sure if maybe PHP works a little different and B is better. Any thoughts?