mysql_free_result

(PHP 4, PHP 5)

mysql_free_result锟酵放斤拷锟斤拷诖锟�

说锟斤拷

mysql_free_result ( resource $result ) : bool

mysql_free_result() 锟斤拷锟酵凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷识锟斤拷 result 锟斤拷锟斤拷锟斤拷锟斤拷锟节存。

mysql_free_result() 锟斤拷锟斤拷要锟节匡拷锟角碉拷锟斤拷锟截很达拷慕锟斤拷锟斤拷时锟斤拷占锟矫讹拷锟斤拷锟节达拷时锟斤拷锟矫★拷锟节脚憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫癸拷锟斤拷锟斤拷锟节存都锟结被锟皆讹拷锟酵放★拷

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

为锟斤拷锟铰硷拷锟斤拷锟斤拷然锟斤拷锟斤拷使锟斤拷 mysql_freeresult()锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

result

resource 锟酵的斤拷锟斤拷锟斤拷锟斤拷私锟斤拷锟斤拷锟斤拷锟皆讹拷 mysql_query() 锟侥碉拷锟矫★拷

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

If a non-resource is used for the result, an error of level E_WARNING will be emitted. It's worth noting that mysql_query() only returns a resource for SELECT, SHOW, EXPLAIN, and DESCRIBE queries.

锟斤拷锟斤拷

Example #1 A mysql_free_result() example

<?php
$result 
mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!
$result) {
    echo 
'Could not run query: ' mysql_error();
    exit;
}
/* Use the result, assuming we're done with it afterwards */
$row mysql_fetch_assoc($result);

/* Now we free up the result and continue on with our script */
mysql_free_result($result);

echo 
$row['id'];
echo 
$row['email'];
?>

注锟斤拷

Note:

为锟斤拷锟斤拷锟铰硷拷锟捷o拷锟斤拷锟斤拷使锟斤拷锟斤拷锟斤拷锟窖凤拷锟斤拷锟侥憋拷锟斤拷锟斤拷 mysql_freeresult()

锟轿硷拷

  • mysql_query() - 锟斤拷锟斤拷一锟斤拷 MySQL 锟斤拷询
  • is_resource() - 锟斤拷锟斤拷锟斤拷锟角凤拷为锟斤拷源锟斤拷锟斤拷