Home >Backend Development >PHP Tutorial >PHP MySQL mysql_query() usage instructions
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.