Difference between revisions of "Db free result" From Online Manual

Jump to: navigation, search
m (refresh SMW properties)
(Better example)
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>$smcFunc['db_free_result']($request);</nowiki>
+
|example=<nowiki>$result = $smcFunc['db_query']('', '
 +
SELECT something
 +
FROM {db_prefix}a_table', array());
 +
 
 +
$array = array();
 +
while ($data = $smcFunc['db_fetch_assoc']($result))
 +
$array[] = $data;
 +
 
 +
$smcFunc['db_free_result']($request);</nowiki>
 
}}
 
}}
 
<noinclude>
 
<noinclude>
 
[[Category:Database Functions]]</noinclude>
 
[[Category:Database Functions]]</noinclude>

Revision as of 10:53, 4 November 2012

Usage:

$smcFunc['db_free_result'] (result)


Description: Works exactly as mysql_free_result. Frees the memory used by the resourse $result.

Parameters:

  • result a query resource as returned by db_query.

Return: will return the exact same results as mysql_free_result.

Example:

$result = $smcFunc['db_query']('', '
	SELECT something
	FROM {db_prefix}a_table', array());

$array = array();
while ($data = $smcFunc['db_fetch_assoc']($result))
	$array[] = $data;

$smcFunc['db_free_result']($request);