EXECUTING DIFFERENCE

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

amarranjandas
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Dec 15, 2010 9:32 pm

EXECUTING DIFFERENCE

Postby amarranjandas » Wed Dec 15, 2010 9:44 pm

i have some confusion about
when i have used a connection.php page for database connection in php and i will include that page in my index.php then the total project will run without any problem and
if i don't used a different page for connection rather i will write the connection code in my index.php page only then also the project will run without any problem.
But my question is that is there any execution time difference for both cases. Please suggest me about the matter.
Thanks in advance.

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: EXECUTING DIFFERENCE

Postby egami » Thu Dec 16, 2010 8:45 am

include() must first find the file, then read the file, then execute the file, where as putting it in your index.php doesn't require any of those steps.

However, I put my dbconnect.php info in a file that isn't in the root or recursive of the HTTP server/service.

amarranjandas
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Dec 15, 2010 9:32 pm

Re: EXECUTING DIFFERENCE

Postby amarranjandas » Thu Dec 16, 2010 8:53 pm

Yes i had a think like you but can you suggest me that which one is better that is...... write the connection code in same page rather in different page and why.....?

User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: EXECUTING DIFFERENCE

Postby egami » Fri Dec 17, 2010 8:01 am

for security reasons, primarily, putting the db credentials in a different file, not accessible to the world via HTTP services.


Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 0 guests