Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is php mysql_query?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what is php mysql_query". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Php mysql_query is a built-in function in PHP to execute a MySQL query. The syntax for this function is "mysql_query (query,connection)", where the parameter query represents the SQL query to be sent.

This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer

What does php mysql_query mean?

The mysql_query () function executes a MySQL query.

Grammar

Mysql_query (query,connection)

Parameters.

Query is required. Specifies the SQL query to be sent. Note: the query string should not end with a semicolon.

Connection is optional. Specifies the SQL connection identifier. If not specified, the last open connection is used.

Description

If there is no open connection, this function attempts to call the mysql_connect () function without arguments to establish a connection and use it.

Return value

Mysql_query () returns only one resource identifier for the SELECT,SHOW,EXPLAIN or DESCRIBE statement, and FALSE if the query executes incorrectly.

For other types of SQL statements, mysql_query () returns TRUE on success and FALSE on error.

A return value other than FALSE means that the query is legal and can be executed by the server. This does not indicate anything about the number of rows affected or returned. It is quite possible that a query was successfully executed but did not affect or return any rows.

Note: this function automatically reads and caches the recordset. To run a non-cached query, use mysql_unbuffered_query ().

Examples

Example 1

Example 2

Create a new database through the mysql_query () function:

This is the end of "what is php mysql_query". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report