Home  >  Article  >  php教程  >  A brief discussion on the return value of the mysql_query() function

A brief discussion on the return value of the mysql_query() function

高洛峰
高洛峰Original
2016-12-22 15:25:231112browse

Problem description:

I was operating mysql and when inserting data, I closed the resource and PHP prompted 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:

When I read the manual, at first glance, I feel that the mysql_query() function returns the resource type, but why is it now? Is the bool value

Summary: From the above, we can know that when mysql_query() executes a sql statement, it does not need to release the result set whenever, but when certain operations produce a result set, it calls mysql_free_result() to release; There is no need to return bool values ​​like insert update, otherwise it will be superfluous

The above article briefly discussing the return value of the mysql_query() function is all the content shared by the editor. I hope it can give you a reference, and I hope everyone will support the PHP Chinese website.

For more articles on the return value of the mysql_query() function, please pay attention to the PHP Chinese website!

Statement:
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