i dont want to interrup here, but dude, now we are talking the OOP era.Object Oriented Programming.Means you use object/classes to connect to databases. Here is the idea;1. Create a connection library using CLASS to define a database object which include all the login informations.2. Include a CONSTRUCTOR which automatically connect to the database when this class is defined.3. Now, all you need to do is to include this library whenever you want to use database function. No more rewriting the same code again!.I can never live without OOP!.