I'm in the process of planning a new site structure. I want to make sure that I am interacting with my-sql db in the most effective way. At present, I have an include file at the top of every page that requires access to database data
eg
include ("global/include_logon_user.php");
This file contains something along the lines of
$connect = @mysql_connect("localhost","user","pas");
@mysql_select_db("database") or die ("Could not connect to database")
I've also set about adding mysql_close($connect) recently to the end of my pages, in an effort to make sure database connections are closed down. I know it does close down automatically but I Wanted to be sure
So, am I going about things in the correct way? Is there anything negative in the way I'm hitting the database and opening a connection with every page request? Can I do things smarter?





Bookmarks