j05hr Posted October 15, 2010 Share Posted October 15, 2010 Hi got a quick question about mysql_close. I'm currently learning PHP from someone with an ASP background. And we were processing a form to another page. (both these pages had a connection to a database.) We wanted to bring the external page into the original form page so we just copy and pasted the code in and it wasn't working. We commented everything out and it turned out it didn't like two mysql_close in the same page. Why is that if the first connection is already closed? I know it's better to use include files for connecting to the database but we are going slowly and learning one step at a time. Quote Link to comment Share on other sites More sharing options...
chintansshah Posted October 15, 2010 Share Posted October 15, 2010 mysql_close() closes the non-persistent connection to the MySQL server that's associated with the specified link identifier. If link_identifier isn't specified, the last opened link is used. Quote Link to comment Share on other sites More sharing options...
rwwd Posted October 15, 2010 Share Posted October 15, 2010 If your learning, then it's worth remembering this:- (quote from the manual, the paragraph underneath the quote that chintansshah posted..) Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. mysql_close() Though this is dependant on the context of your script. Rw Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.