Results 1 to 3 of 3
May 13, 2003, 13:28 #1
Effective interaction with a my-sql database
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
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?One of lifes luxuries ...
May 13, 2003, 14:11 #2
- Join Date
- Jul 2002
- Along the Wasatch Fault line.
- 0 Post(s)
- 0 Thread(s)
If you are going to be in constant contact with your database, look into persistant connections.
mysql_pconnect() is a good place to start.John
May 14, 2003, 03:01 #3Originally Posted by PHP John
What do others use here?One of lifes luxuries ...