Db free result: Difference between revisions From Online Manual

Jump to: navigation, search
mNo edit summary
No edit summary
 
Line 8: Line 8:
}}
}}
|return=will return the exact same results as [http://php.net/mysql_free_result mysql_free_result].
|return=will return the exact same results as [http://php.net/mysql_free_result mysql_free_result].
|example=<nowiki>$result =// Grab a result from the database.
|example=<nowiki>// Grab a result from the database.
$smcFunc['db_query']('', '
$result = $smcFunc['db_query']('', '
SELECT something
SELECT something
FROM {db_prefix}a_table', array());
FROM {db_prefix}a_table', array());

Latest revision as of 16:00, 4 November 2012

Usage:

$smcFunc['db_free_result'] (result)


Description: Frees the memory in use by the result from a query. Works exactly as mysql_free_result. This is usually called after the data has been fetched from the database.

Parameters:

  • result a query resource as returned by db_query.

Return: will return the exact same results as mysql_free_result.

Example:

// Grab a result from the database.
$result = $smcFunc['db_query']('', '
	SELECT something
	FROM {db_prefix}a_table', array());

// Fetch the data from it.
$array = array();
while ($data = $smcFunc['db_fetch_assoc']($result))
	$array[] = $data;

// Then free the result.
$smcFunc['db_free_result']($request);



Advertisement: