// Add, modify, and delete the number of affected records
Public function _ affected_rows (){
$ This-> rowAff = mysql_affected_rows ();
Return $ this-> rowAff;
}
// Obtain the ID number of the previous INSERT operation
Public function _ insert_id (){
Return mysql_insert_id ();
}
// Release the result set
Public function _ free_result (){
$ This-> rowAff = '';
$ This-> rowArray = '';
$ This-> rowRst = '';
Mysql_free_result ($ this-> result );
}
// Close the database
Public function _ close_conn (){
$ This-> _ free_result ();
Mysql_close ($ this-> conn );
}
}
When I use the _ close_conn method, mysql_free_result (): supplied argument is not a valid mysql result resource is displayed on the webpage.
How to solve this problem
------ Solution --------------------
Before mysql_free_result ($ this-> result); you should first take a look at what $ this-> result has become. Is it the resource you opened?
------ Solution --------------------
If (is_resource ($ this-> result ))
{
Mysql_free_result ($ this-> result );
$ This-> result = NULL;
}
------ Solution --------------------
The value of your $ this-> result is as follows:
$ This-> result = mysql_query ($ SQL, $ this-> conn)
Mysql_query only returns resources when the select statement is executed, and others are logical values.
So mysql_free_result ($ this-> result );
To write
If (is_resource ($ this-> result) mysql_free_result ($ this-> result );
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.