For mysql_close (), is it best to manually close mysql_close () when using connect ., You can do this at the end of the file. after the database operation is completed, you can use mysql_close (). This is about mysql_close ()
Can you manually close mysql_close () if we use connect ()?
If necessary, where is the best place to put this statement.
------ Solution --------------------
Yes
At the end of the file, you can
------ Solution --------------------
The final part of this document is OK.
------ Solution --------------------
After the database operation is complete, mysql_close () is a good habit.
In addition, remember to use mysql_free_result () after the record set is used up.
------ Solution --------------------
Upstairs ....
------ Solution --------------------
Will be automatically disabled, of course it will be better to write
------ Solution --------------------
Yes! When used up, close it in time, and the resource will be given up
------ Solution --------------------
Learning !!
------ Solution --------------------
Discussion
After the database operation is complete, mysql_close () is a good habit.
In addition, remember to use mysql_free_result () after the record set is used up.
------ Solution --------------------
Mysql_free_result () is used to release the memory occupied by a select query, and mysql_close () is used to close a connection of mysql_connect. It is usually placed in the last line of the program (close the connection until this mysql connection is not used). Originally, php has its own function to release query resources and close the database, but manually write the program, it is a good habit to release the memory in time and close the connection.
------ Solution --------------------
Php will be automatically released, but I don't know when to release it. I haven't seen the php source code.
------ Solution --------------------
11 floor is supported...
------ Solution --------------------
No, especially for beginners! Php will complete for you
Although it is important to release resources, the release time does not bring unnecessary trouble.
For example, "If the returned query dataset is mysql_close (), it will be OK before return $ query. How can I report an error"
Mysql_query returns a system resource number. the query result is in the mysql buffer and is not passed to php. In the future, php will use this resource number to obtain data from mysql. If the connection is closed before that, how can we do it in the future?
------ Solution --------------------
The database must be closed when it is opened.
This reduces the pressure on servers, saves resources, and operates safely.
------ Solution --------------------
After reading this, I think the eighth floor is good.
------ Solution --------------------
Long knowledge
------ Solution --------------------
......
------ Solution --------------------
No. mysql_close ()
------ Solution --------------------
Lu guo
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service