Home  >  Article  >  Backend Development  >  PHP MySQL mysql_query() usage instructions

PHP MySQL mysql_query() usage instructions

WBOY
WBOYOriginal
2016-08-08 09:27:131415browse

mysql_query() function executes a MySQL query.

The syntax is as follows:
mysql_query(query,connection);
The parameter query is required and specifies the SQL query to be sent.
The parameter connection is optional and specifies the SQL connection identifier. If it is set, the last opened connection is used.
If there is no open connection, it will try to establish a connection by calling the mysql_connect() function without parameters.

mysql_query() only returns a resource identifier for SELECT, SHOW, EXPLAIN, and DESCRIBE statements.

mysql_query() will automatically read and cache the record set. If you do not need to cache the query, you can use mysql_unbuffered_query().

The above introduces the usage instructions of PHP MySQL mysql_query(), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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