php man page for oci_num_fields

Query: oci_num_fields

OS: php

Section: 3

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

OCI_NUM_FIELDS(3)														 OCI_NUM_FIELDS(3)

oci_num_fields - Returns the number of result columns in a statement

SYNOPSIS
int oci_num_fields (resource $statement)
DESCRIPTION
Gets the number of columns in the given $statement.
PARAMETERS
o $statement - A valid OCI statement identifier.
RETURN VALUES
Returns the number of columns as an integer, or FALSE on errors.
EXAMPLES
Example #1 oci_num_fields(3) example <?php // Create the table with: // CREATE TABLE mytab (id NUMBER, quantity NUMBER); $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT * FROM mytab"); oci_execute($stid, OCI_DESCRIBE_ONLY); // Use OCI_DESCRIBE_ONLY if not fetching rows $ncols = oci_num_fields($stid); for ($i = 1; $i <= $ncols; $i++) { echo oci_field_name($stid, $i) . " " . oci_field_type($stid, $i) . "<br> "; } // Outputs: // ID NUMBER // QUANTITY NUMBER oci_free_statement($stid); oci_close($conn); ?>
NOTES
Note In PHP versions before 5.0.0 you must use ocinumcols(3) instead. This name still can be used, it was left as alias of oci_num_fields(3) for downwards compatability. This, however, is deprecated and not recommended. PHP Documentation Group OCI_NUM_FIELDS(3)
Related Man Pages
oci_define_by_name(3) - php
oci_field_is_null(3) - php
oci_field_precision(3) - php
oci_field_scale(3) - php
oci_new_cursor(3) - php
Similar Topics in the Unix Linux Community
setting width in echo statement
nestes 'if' statement
check number or character of a file
IF &amp;&amp; statement problem
Help with a simple function