PHP mysql_free_result() Function
Definition and Usage
The mysql_free_result() function releases the result memory.
Returns true if successful, false if not.
Syntax
mysql_free_result(data)
Parameter | Description |
---|---|
data | Required. The result identifier to be released. The result identifier is from mysql_query() The returned results. |
Tips and Comments
Note:mysql_free_result() should be called only when considering how much memory a large result set will consume. All associated memory will be automatically released at the end of the script.
Example
<?php $con = mysql_connect("localhost", "peter", "abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db",$con); $sql = "SELECT * from Person"; $result = mysql_query($sql,$con); print_r(mysql_fetch_row($result)); // Free memory mysql_free_result($result); $sql = "SELECT * from Customers"; $result = mysql_query($sql,$con); print_r(mysql_fetch_row($result)); mysql_close($con); ?>