The sql_free() function is used to release an SQL resource opened using a call to the sql_select() function. Ideally this function ought to be called after finishing using each resource.

It accept 3 parameters:

  1. $res is the resource for a selection,
  2. $serveur,
  3. $option.

The sql_free() function is therefore used as shown below:

$res = sql_select('column', 'table');
// operations using the sql_fetch($res) and similar functions ...
// then close the resource

Note that the API functions call this function automatically. This is the case for:

  • sql_fetsel (and sql_getfetsel),
  • sql_fetch_all (and sql_allfetsel),
  • sql_in_select.

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français