PHP Read File
1. PHP file when the $testfilename2 incredibly is not to single quotation marks, or double quotation marks will be error, and later with the variable should be more single quotation marks
?
?
$testfilename 2= ' D:\ProgramFiles2\AppServ\www\catch28\admin\testmethod6.html ';//filename, can be a text file such as. php or. txt
File_put_contents ($testfilename, " );
2. Mysql_free_result () does not need to be called at the time of the update operation:
Mysql_free_result
(PHP 4, PHP 5)
mysql_free_result -free result memory
Description
BOOL
Mysql_free_result( Resource $result )
mysql_free_result () would free all memory associated with the result identifier result.
mysql_free_result () only needs to being called if you were concerned about how much memory was being used for queries That return large result sets. All associated result memory are automatically freed at the end of the script ' s execution.
Parameters
?
Result
The result resource thatis being evaluated. This result is comes from a call tomysql_query ().
Return Values
Returns TRUE on success or FALSE on failure.
If a non-resource is used for the result, an error of level e_warning would be emitted. It ' s worth noting that mysql_query () only returns a resource for SELECT, SHOW, EXPLAIN, and DESCRIBE Q Ueries.
Examples
?
Example #1 A mysql_free_result () Example
$result? =?mysql_query("Select?id,email?" From?people? Where?id?=? ' ' ");
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 '];
?>
Notes
Note: For backward compatibility, the followingdeprecated alias could be used: mysql_freeresult ()
See Also
?
- mysql_query ()-Send a MySQL query
- Is_resource ()-Finds Whether a variable is a resource
If you need? mysql_free_result (), received this error. What causes it and how can I fix it?
First, what is mysql_free_result ()? When you makemysql database queries This return large sets of data, it can causeyour server to bog down because those resu LTS is hogging up a lot ofmemory. On a high-traffic site, it can actually crash your server Asmore and more of the those results build up. So, mysql_free_result ()are a built-in PHP function that releases the results of your query frommemory. Again, this is usually isn't a big deal unless you be returninglarge data sets from your queries, but it's always good PRA Ctice Toclear your results and free up the memory on your server. Here's anexample of what the PHP code might look like:
?
?
//... CONNECT to DATABASE ... $query = "SELECT * FROM Employees WHERE age >=", if ($result = mysql_query ($query)) {while ($ro W = mysql_fetch_array ($result)) {//... Do SOMETHING ...} Mysql_free_result ($result); Free the query results from memory}///... CLOSE YOUR databse CONNECTION ...
? But if you had strict PHP warnings enabled on your server, you maystart getting the warning above for some of your queries. I had a really hard time tracking this problem down and I finallyfound it here. Use
mysql_free_result ()For the following query Types:select, SHOW, EXPLAIN, and DESCRIBE. so,if Perform an UPDATE query, it doesn ' t return a valid resource andthrows the warning when you call Mysql_free_r Esult ().Duh.