Detailed explanation of the return value of mysql_query() function

墨辰丷
Release: 2023-03-29 07:24:01
Original
4630 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!