MySQL Forums
Forum List  »  PHP

Including a connection.php file for database access
Posted by: Jay NOYB
Date: May 08, 2009 08:52AM

I was looking over a tutorial and noticed they used a "connection.php" - then 'included' it in subsequent PHP pages so they didn't have to type it out over and over.

What I've been doing is connecting to the database separately on each page.

Is either method "better"? I guess by "better" I mean more secure or more efficient? It seems a lot easier to use the 'include connection.php' method, but it's the first time I've come across it.

On top of that - when does the database close? Is it when the php page had done all its work and put out the html code, or when the user closes the page?

Options: ReplyQuote


Subject
Written By
Posted
Including a connection.php file for database access
May 08, 2009 08:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.