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);
##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!