PHP mysqli_query() 函数
PHP 教程
· 2019-01-28 10:29:10
执行针对数据库的查询:
删除数据库
// 假定数据库用户名:root,密码:123456,数据库:CODERCTO
$con=mysqli_connect("localhost","root","123456","CODERCTO");
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);
定义和用法
mysqli_query() 函数执行某个针对数据库的查询。
语法
mysqli_query(connection,query,resultmode);
| 参数 | 描述 |
|---|---|
| connection | 必需。规定要使用的 MySQL 连接。 |
| query | 必需,规定查询字符串。 |
| resultmode |
可选。一个常量。可以是下列值中的任意一个:
|
技术细节
| 返回值: | 针对成功的 SELECT、SHOW、DESCRIBE 或 EXPLAIN 查询,将返回一个 mysqli_result 对象。针对其他成功的查询,将返回 TRUE。如果失败,则返回 FALSE。 |
|---|---|
| PHP 版本: | 5+ |
| 更新日志: | 在 PHP 5.3.0 中新增了异步查询的功能。 |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Twenty Lectures on Algorithmic Game Theory
Tim Roughgarden / Cambridge University Press / 2016-8-31 / USD 34.99
Computer science and economics have engaged in a lively interaction over the past fifteen years, resulting in the new field of algorithmic game theory. Many problems that are central to modern compute......一起来看看 《Twenty Lectures on Algorithmic Game Theory》 这本书的介绍吧!