PHP mysqli_field_count() 函数
PHP 教程
· 2019-01-27 22:27:12
假设我们有一个 "websites" 表,其中有 5 个字段 20 行记录。返回最近查询的列数:
<?php
// 假定数据库用户名: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");
// 获取列数
echo mysqli_field_count($con);
mysqli_close($con);
?>
定义和用法
mysqli_field_count() 函数返回最近查询的列数。
语法
mysqli_field_count(connection);
| 参数 | 描述 |
|---|---|
| connection | 必需。规定要使用的 MySQL 连接。 |
技术细节
| 返回值: | 返回一个表示结果集中列数的整数。 |
|---|---|
| PHP 版本: | 5+ |
点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html
Inside Larry's and Sergey's Brain
Richard Brandt / Portfolio / 17 Sep 2009 / USD 24.95
You’ve used their products. You’ve heard about their skyrocketing wealth and “don’t be evil” business motto. But how much do you really know about Google’s founders, Larry Page and Sergey Brin? Inside......一起来看看 《Inside Larry's and Sergey's Brain》 这本书的介绍吧!