/    Sign up×
Community /Pin to ProfileBookmark

connecting database

I need ur suggestions on how we can connect the database so that it won’t affect the process speed/memory. Now in every php page i am calling a phpfile using include_once which is having the connection with mysql. In each page i am including this file. Is this is the right method? Is any other method which will work comfortably and won’t take much memory. How we can release/reintialise once its use is over?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@nooor83May 12.2006 — im using the same way..but i saw an open source project where php is 100% OOP....i heared that using opps may slow down the performance if your web traffic is high...but i reduces the LOC alot..


Regards,

Noor
Copy linkTweet thisAlerts:
@aaronbdavisMay 12.2006 — from what I understand, yes that is the right way to do things. There is also the function mysql_pconnect which opens a persistent connection, but from what I have read on a couple posts here in the forums, this is not a good idea. When using the method you currently are using, make sure to close the connection when the script is completed.
Copy linkTweet thisAlerts:
@anubauthorMay 13.2006 — thanks for ur replies. just tell me how i can close the connection?
Copy linkTweet thisAlerts:
@nooor83May 13.2006 — mysql_close($your_cnn_link);
×

Success!

Help @anub spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...