AP81 Posted February 27, 2008 Share Posted February 27, 2008 Hi, I am designing a new database class (connection, query, etc) and was thinking of making it a singleton class to save on resources. My question is, if I have two PHP pages concurrently performing a database query (using this singleton class), will the database queries be interrupted due to having only one instance of the class? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 27, 2008 Share Posted February 27, 2008 regardless of how you structure your OOP it still is going to need to use the mysql function library i.e mysql_query mysql_fetch_assoc, mysql_num_rows etc. Those functions all depend on your mysql config in how they function so the singleton idea fails because mysql allow multiple concurrent connections. In addition classes don't carry across pages beautifully as you would expect. In conclusion if you really want to redesign mysql to work in an OOP function just build it to help you, and don't worry about structure. There is no resource bonus from going your method because it requires additional processing to work, you can't decompile the raw functions to work in different ways. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.