Technical Question About mysql_connect
Posted on 2002-04-11
Hi There Everybody,
i have a simple question, i hope you will understand my needs to accomplish this the better way possible .
i have all my pages calling a page called functions.inc, where i have two functions like this..
StartTheDatabase(); // Opens The Database
CloseTheDatabase; // Closes It
Well, what is the better way to have everything done, having the least ports to the mysql server open ??
i mean, shall i StartTheDatabase() and CloseTheDatabase() Everytime I Need It, Or Shall i Start it once in the start of the page and close it at the end of it ??
i am using mysql_connect in the StartTheDatabase function, maybe changing to pconnect is better ?
the matter is that index.php includes 5 different pages, footer header and some more, and each of them accesses the database on its own way, when i load index.php in the browser, i get about 28 queries to the database to generate the page, but i need everything to be optimized to get 1 or 2 connection at maximum opened for each page load
i hope you understood my point ..