PHP mysqli_free_result()Function
Fetch a row from the result set, then free the result memory:
mysqli_fetch_array()
//Assume database username: root, password: 123456, database: EXAMPLE
$con=mysqli_connect("localhost","root","123456","EXAMPLE");
if (mysqli_connect_errno($con))
{
echo "Connection to MySQL failed:" . mysqli_connect_error();
}
$sql="SELECT name,url FROM websites ORDER BY alexa";
if ($result=mysqli_query($con,$sql))
{
//Fetch row by row
while ($row=mysqli_fetch_row($result))
{
printf ("%s : %s",$row[0],$row[1]);
echo "<br>";
}
//Free the result set
mysqli_free_result($result);
}
mysqli_close($con);
Definition and Usage
The mysqli_free_result() function frees result memory.
Syntax
mysqli_free_result(result);
| Parameters | Description |
|---|---|
| result | Required. Specifies the result set identifier returned by mysqli_query(), mysqli_store_result(), or mysqli_use_result(). |
Technical Details
| Return value: | No return value. |
|---|---|
| PHP Version: | 5+ |
PHP MySQLi Reference Manual Other Extensions