PDO usage

Pierre Bouillon - Nov 9 '17 - - Dev Community

I'm building a website and I have several SQL requests in several files.

My question is should I :

  • make a "global" PDO in a file and include the file to use it every time I need to do a request (but when close the connection?)

OR

  • create a PDO before each request and then close the connection

What will be the best practice and why?
Thanks and happy coding !

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player