Name

mysql_free_result

Synopsis

boolean mysql_free_result(qresource query)

Frees all memory used by a query resource handle. This occurs automatically at the end of a script, but this function may be useful in scripts where repeated querying is performed or memory is constrained.

The function returns true on success and false on error.

Example

<?php
  $query = "SELECT * FROM presents";
  
  $connection = mysql_connect("localhost", "fred", "shhh");
  mysql_select_db("wedding", $connection);
  
  $result = mysql_query($query, $connection);
  
  while ($row = mysql_fetch_object($result, MYSQL_ASSOC))
  {
     echo "\n\nQuantity:\t" . $row->quantity;
     echo "\nPresent:\t" . $row->present;
     echo "\nShop:\t" . $row->shop;
  }
  
  mysql_free_result($result);
?>

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.