This article mainly introduces the detailed explanation of the return value of the mysql_query() function. Interested friends can refer to it. I hope it will be helpful to everyone.
Problem description:
I am operating mysql and when inserting data, I close the resource and PHP prompts a warning. The content is roughly as follows: you need to give mysql_free_result() a resource type.
Then, I will return the result var_dump($res) and find that it is a bool value
Analysis:
Look When reading the manual, at first glance, I feel that the mysql_query() function returns a resource type, but why is it a bool value now? Well, after reading the manual patiently, I discovered that the principle is like this, as shown in the picture below:
##Summary:From the above, we can know that when mysql_query() executes a sql statement, it does not have to release the result set whenever, but when certain operations produce a result set, it calls mysql_free_result() to release; like insert update returns bool It’s not necessary if it’s worthwhile, otherwise it will be superfluous
The above is the entire content of this article, I hope it will be helpful to everyone’s study. Related recommendations:phpImplementing two-dimensional array time sorting
phpMethods to solve DOM garbled characters
phpA brief introduction to date.timezone setting in .ini
The above is the detailed content of Detailed explanation of the return value of mysql_query() function. For more information, please follow other related articles on the PHP Chinese website!