db2_num_fields(3) php man page | unix.com

Man Page: db2_num_fields

Operating Environment: php

Section: 3

DB2_NUM_FIELDS(3)							 1							 DB2_NUM_FIELDS(3)

db2_num_fields - Returns the number of fields contained in a result set

SYNOPSIS
int db2_num_fields (resource $stmt)
DESCRIPTION
Returns the number of fields contained in a result set. This is most useful for handling the result sets returned by dynamically generated queries, or for result sets returned by stored procedures, where your application cannot otherwise know how to retrieve and use the results.
PARAMETERS
o $stmt - A valid statement resource containing a result set.
RETURN VALUES
Returns an integer value representing the number of fields in the result set associated with the specified statement resource. Returns FALSE if the statement resource is not a valid input value.
EXAMPLES
Example #1 Retrieving the number of fields in a result set The following example demonstrates how to retrieve the number of fields returned in a result set. <?php $sql = "SELECT id, name, breed, weight FROM animals ORDER BY breed"; $stmt = db2_prepare($conn, $sql); db2_execute($stmt, $sql); $columns = db2_num_fields($stmt); echo "There are {$columns} columns in the result set."; ?> The above example will output: There are 4 columns in the result set.
SEE ALSO
db2_execute(3), db2_field_display_size(3), db2_field_name(3), db2_field_num(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3). PHP Documentation Group DB2_NUM_FIELDS(3)
Related Man Pages
db2_fetch_both(3) - php
db2_field_scale(3) - php
db2_field_type(3) - php
db2_num_fields(3) - php
sqlsrv_num_fields(3) - php
Similar Topics in the Unix Linux Community
Using a variable in sqlplus
Extracting columns
issues with sql inside if statement
Replacing 12 columns of one file by second file based on mapping in third file
CUT command not giving correct result inside loop