10bet网址
mysql php api.
下载本手册

mysql php api./....../ mysqli_stmt :: $ field_count,mysqli_stmt_field_count

3.9.14mysqli_stmt :: $ field_countmysqli_stmt_field_count.

版权所有1997-2021 PHP文档组。10bet官方网站

  • mysqli_stmt :: $ field_count

    mysqli_stmt_field_count.

    返回给定语句中的列数

描述

面向对象的风格

mysqli_stmt-> field_count.;

程序风格

mysqli_stmt_field_count.mysqli_stmt.陈述);

返回准备好语句中的列数。

参数

STMT.

仅限程序样式:返回的语句标识符mysqli_stmt_init.

返回值

返回表示列数的整数。

例子

示例3.86面向对象的样式

<?php mysqli_report(mysqli_report_error | mysqli_report_strict);$ mysqli = new mysqli(“localhost”,“my_user”,“my_password”,“world”);$ code ='fr';$ stmt = $ mysqli->准备(从code =的国家/地区选择名称?);$ stmt-> bind_param('s',$ code);$ stmt-> execute();$行= $ $ stmt-> get_result() - > fetch_row();for($ i = 0; $ i <$ stmt-> field_count; $ i ++){printf(“列号的值%d为%s”,$ i,$行[$ i];}

示例3.87程序风格

<?php mysqli_report(mysqli_report_error | mysqli_report_strict);$ mysqli = mysqli_connect(“localhost”,“my_user”,“my_password”,“world”);$ code ='fr';$ stmt = mysqli_prepare($ mysqli,从code =的国家/地区选择名称);mysqli_stmt_bind_param($ stmt,'s',$ code);mysqli_stmt_execute($ stmt);$结果= mysqli_stmt_get_result($ stmt);$行= mysqli_fetch_row($结果);for($ i = 0; $ i 

以上示例将输出类似于:

第0列的价值是法国

也可以看看

mysqli_stmt_num_rows.