More connects better or less?
Posted 19 May 2006 - 05:20 AM
This isn't huge... but I'm just wondering, is it better to do a connect and close mysql command before and after EACH query, or is it better to do one connect command at the beginning of page execution and a close command at the end?
I'm curious about security and efficiency. Is doing more queries a lot more intensive on the server, and if I do one connect and one close is that leaving myself open to attacks?
Posted 19 May 2006 - 05:43 AM
Posted 19 May 2006 - 07:22 AM
I'll tell you right now that is more effecient to open one connection at the beginning of the page and close it at the end of the page then it is to open and close a new connection for each query. I'm not sure about security, but I don't think you'll have a problem using just one connection per page instead of one connection per query.
OK, thanks a lot.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users