Home > Database > Mysql Tutorial > Definition and usage examples of mysql execution function mysql_query()

Definition and usage examples of mysql execution function mysql_query()

迷茫
Release: 2017-04-07 17:57:05
Original
9830 people have browsed it

As long as we operate on the tables in the database, we usually use the mysql_query() function to execute sql statements. The mysql_query() function executes a MySQL query.

Syntax: mysql_query(query,connection)

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

connection: optional. Specifies the SQL connection identifier. If not specified, the last opened connection is used.

Let’s see how to use it

We have a database study with a table named admin

We now want to query all the data in this table Data

$sql = "select * from admin" ;

At this time we need to use mysql_query to execute the sql statement

mysql_query($sql);

Definition and usage examples of mysql execution function mysql_query()

##Of course, we need to use the mysql_query function to add, delete, modify and query sql statements

The above is the detailed content of Definition and usage examples of mysql execution function mysql_query(). 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template