php man page for db2_num_fields

Query: db2_num_fields

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

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_row(3) - php
db2_fetch_array(3) - php
db2_fetch_object(3) - php
db2_field_name(3) - php
db2_field_precision(3) - php
Similar Topics in the Unix Linux Community
issues with sql inside if statement
How to compare to values returned from sql in shell scripting?
Passing variable from file to sql from script
Emailing results of a pl sql procedure from UNIX shell script
Generate sql statement using shell scripting