cubrid_num_fields

(PECL CUBRID >= 8.3.0)

cubrid_num_fieldsReturn the number of columns in the result set

说明

cubrid_num_fields ( resource $result ) : int

This function returns the number of columns in the result set, on success, or it returns FALSE on failure.

参数

result

result comes from a call to cubrid_execute(), cubrid_query() and cubrid_prepare()

返回值

Number of columns, on success.

-1 if SQL sentence is not SELECT.

FALSE when process is unsuccessful.

范例

Example #1 cubrid_num_fields() example

<?php
$conn 
cubrid_connect("localhost"33000"demodb");

$req cubrid_execute($conn"SELECT * FROM code");

$row_num cubrid_num_rows($req);
$col_num cubrid_num_fields($req);

printf("Row Num: %d\nColumn Num: %d\n"$row_num$col_num);

cubrid_disconnect($conn);
?>

以上例程会输出:

Row Num: 6
Column Num: 2
相关文章
php cubrid mysql 兼容性函数 return the number of rows affected by the last sql statementphp cubrid mysql 兼容性函数 return the current cubrid connection charsetphp cubrid mysql 兼容性函数 move the internal row pointer of the cubrid resultphp cubrid mysql 兼容性函数 return the numerical value of the error message from previous cubrid operationphp cubrid mysql 兼容性函数 fetch a result row as an associative array a numeric array or bothphp cubrid mysql 兼容性函数 return the associative array that corresponds to the fetched rowphp cubrid mysql 兼容性函数 get column information from a result and return as an objectphp cubrid mysql 兼容性函数 return an array with the lengths of the values of each field from the current rowphp cubrid mysql 兼容性函数 fetch the next row and return it as an objectphp cubrid mysql 兼容性函数 return a numerical array with the values of the current rowphp cubrid mysql 兼容性函数 return a string with the flags of the given field offsetphp cubrid mysql 兼容性函数 return the name of the specified field indexphp cubrid mysql 兼容性函数 move the result set cursor to the specified field offsetphp cubrid mysql 兼容性函数 return the name of the table of the specified fieldphp cubrid mysql 兼容性函数 return the type of the column corresponding to the given field offsetphp cubrid 函数 return the number of columns in the result setphp cubrid mysql 兼容性函数 return the number of columns in the result setphp cubrid 函数 get the number of rows in the result setphp cubrid mysql 兼容性函数 return the value of a specific field in a specific rowphp maxdb 函数 return the number of rows in statements result set
关注编程学问公众号