PHP mysql_free_result() Function Example

PHP mysql_free_result() Function Example


Posted in : PHP Posted on : February 19, 2011 at 6:09 PM Comments : [ 0 ]

If you want to free memory used by the result handle then use mysql_free_result() function.

PHP mysql_free_result() Function Example:

If you want to free memory used by the result handle then use mysql_free_result() function. This function return true when memory is free or false on failure.

Syntax:

mysql_free_result(data)

where data is required: specifies which result handle to free.

Example:

<?php
$connection = mysql_connect("localhost","root","root");
if (!$connection)
{
die('PHP Mysql database connection could not connect : ' . mysql_error());
}

$db_selected = mysql_select_db("php_mysql", $connection);

$sql_query = "select * from user";
$result = mysql_query($sql_query, $connection);

print_r(mysql_fetch_row($result));

echo "<br />";

mysql_free_result($result);

$sql_query = "select * from user";
$result = mysql_query($sql_query, $connection);
print_r(mysql_fetch_row($result));

mysql_close($connection);
?> 

The database 'user' table is:

Output:

Array ( [0] => 3 [1] => Deepak [2] => deepak@rediffmail.com [3] => Noida ) 
Array ( [0] => 3 [1] => Deepak [2] => deepak@rediffmail.com [3] => Noida )

Download Example Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics