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
The Smashing Book
Jacob Gube、Dmitry Fadeev、Chris Spooner、Darius A Monsef IV、Alessandro Cattaneo、Steven Snell、David Leggett、Andrew Maier、Kayla Knight、Yves Peters、René Schmidt、Smashing Magazine editorial team、Vitaly Friedman、Sven Lennartz / 2009 / $ 29.90 / € 23.90
The Smashing Book is a printed book about best practices in modern Web design. The book shares technical tips and best practices on coding, usability and optimization and explores how to create succes......一起来看看 《The Smashing Book》 这本书的介绍吧!