/    Sign up×
Community /Pin to ProfileBookmark

Whether mysql connection will last until we close that page?

Hi, suppose if we are connecting to a database using mysql_connect …
That connection will last until we go to the next page or close that page??????
And one more doubt is that after every transaction or commit the connection to the database will terminate?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@scragarFeb 25.2009 — The connection lasts till the end of the PHP code, it's closed with mysql_close, or, in the case of persistent connections until the connection is forced to close.
Copy linkTweet thisAlerts:
@rexpsunnyauthorFeb 26.2009 — [code=php]Please be specify that suppose we run a mysql_query and after that mysql_fetch_assoc.. I need to ask that after this execution whether our mysql connection will end up???[/code]
Copy linkTweet thisAlerts:
@scragarFeb 26.2009 — Erm, using the forums php code tags for normal text, that's intresting ?

As I said, the connection will stay open until the end of the page execution(where PHP does this automatically as a part of the clean up), you close it yourself( mysql_close() ).

It does not close just because you've run a query or read any results.
Copy linkTweet thisAlerts:
@rexpsunnyauthorFeb 26.2009 — oh okkkkk ? im new to this forum.... anyways thanks ?
×

Success!

Help @rexpsunny 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.16,
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,
)...