Hi,
Which way is the best practice of opening/closing MySQL connection in PHP?
examples:
1) Making only one connection per script (one resouce)
- open connection at the beginning of the script
- do as many as query operations
- close connection at the end of the script
2) Making as many as connections needed but also close them right after the query is done done (many resources)
beginning of script
...
...
...
- open connection
- do query operation(s)
- close connection right after the query
...
...
...
- open connection
- do query operation(s)
- close connection right after the query
...
...
...
- open connection
- do query operation(s)
- close connection right after the query
...
...
...
end of script
Any ideas?