Home > Article > Backend Development > How to close the result set in php
php method to close the result set: 1. Recycle the result set through "mysql_free_result($b);"; 2. Use "mysql_close($con);" to close the database connection.
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
How to close the result set in php?
Use mysql_free_result($b); to recycle the result set;
Use mysql_close($con); to close the database connection;
mysql_free_result() The function frees the resulting memory.
Returns true if successful, false if failed.
Syntax
mysql_free_result(data)
Parameter data is required. The result identifier to be freed. The result identifier is the result returned from mysql_query().
mysql_close() Function closes non-persistent MySQL connections.
Syntax
mysql_close(link_identifier)
Parameters link_identifier required. MySQL connection identifier. If not specified, the connection last opened by mysql_connect() is used by default. If the connection is not found, the function attempts to call mysql_connect() to establish a connection and use it. If an accident occurs and the connection is not found or cannot be established, the system issues an E_WARNING level warning message.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to close the result set in php. For more information, please follow other related articles on the PHP Chinese website!