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?
@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.
@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]
@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.