The role of mysqli_query function in php
Definition and usage
## The #mysqli_query() function executes a query against the database. Syntaxmysqli_query(connection,query,resultmode);
Execute a query against the database:
Delete the database
<?php // 假定数据库用户名:root,密码:123456,数据库:RUNOOB $con=mysqli_connect("localhost","root","123456","RUNOOB"); if (mysqli_connect_errno($con)) { echo "连接 MySQL 失败: " . mysqli_connect_error(); } // 执行查询 mysqli_query($con,"SELECT * FROM websites"); mysqli_query($con,"INSERT INTO websites (name, url, alexa, country) VALUES ('百度','https://www.baidu.com/','4','CN')"); mysqli_close($con); ?>
The above is the detailed content of The role of mysqli_query function in php. For more information, please follow other related articles on the PHP Chinese website!